Hide/show account management ui based on authentication mode

This commit is contained in:
Johannes Zellner 2016-08-11 14:44:43 +02:00
parent b9f4b286c5
commit 67fc7939df
3 changed files with 84 additions and 63 deletions

View file

@ -7,58 +7,66 @@
<hr>
<form class="form-horizontal" method="post" action="/users/account">
{{#if ldap.enabled}}
<p>
This account is managed through LDAP.<br/>
<br/>
Associated Email Address: <a href="mailto:{{email}}">{{email}}</a>
</p>
{{else}}
<form class="form-horizontal" method="post" action="/users/account">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<fieldset>
<legend>
General Settings
</legend>
<fieldset>
<legend>
General Settings
</legend>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email Address</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="email" value="{{email}}" placeholder="Your e-mail address" required>
<span class="help-block">This address is used for account recovery in case you loose your password</span>
</div>
</div>
</fieldset>
<fieldset>
<legend>
Password change
</legend>
<p>
You only need to fill out this form if you want to change your current password
</p>
<div class="form-group">
<label for="currentPassword" class="col-sm-2 control-label">Current Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="currentPassword" id="currentPassword" placeholder="Current Password">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">New Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="password" placeholder="New Password">
</div>
</div>
<div class="form-group">
<label for="password2" class="col-sm-2 control-label">Confirm Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password2" id="password2" placeholder="Confirm New Password">
</div>
</div>
</fieldset>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">Email Address</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email" id="email" value="{{email}}" placeholder="Your e-mail address" required>
<span class="help-block">This address is used for account recovery in case you loose your password</span>
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-ok"></i> Update</button>
</div>
</div>
</fieldset>
<fieldset>
<legend>
Password change
</legend>
<p>
You only need to fill out this form if you want to change your current password
</p>
<div class="form-group">
<label for="currentPassword" class="col-sm-2 control-label">Current Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="currentPassword" id="currentPassword" placeholder="Current Password">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">New Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="password" placeholder="New Password">
</div>
</div>
<div class="form-group">
<label for="password2" class="col-sm-2 control-label">Confirm Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password2" id="password2" placeholder="Confirm New Password">
</div>
</div>
</fieldset>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-ok"></i> Update</button>
</div>
</div>
</form>
</form>
{{/if}}

View file

@ -8,22 +8,30 @@
<hr>
<p>Please provide the username or email address that you used when you signed up for your Mailtrain account.</p>
<p>We will send you an email that will allow you to reset your password.</p>
{{#if ldap.enabled}}
<p>
Accounts are managed through LDAP.<br/>
<br/>
<a href="{{ldap.passwordresetlink}}">Reset Password</a>
</p>
{{else}}
<p>Please provide the username or email address that you used when you signed up for your Mailtrain account.</p>
<p>We will send you an email that will allow you to reset your password.</p>
<form class="form-horizontal" role="login" method="post" action="/users/forgot">
<form class="form-horizontal" role="login" method="post" action="/users/forgot">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<div class="form-group">
<label for="usernameMain" class="col-sm-2 control-label">Username</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="username" id="usernameMain" placeholder="Username or email address" autofocus required>
<div class="form-group">
<label for="usernameMain" class="col-sm-2 control-label">Username</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="username" id="usernameMain" placeholder="Username or email address" autofocus required>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<button type="submit" class="btn btn-primary">Send verification email</button>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<button type="submit" class="btn btn-primary">Send verification email</button>
</div>
</div>
</div>
</form>
</form>
{{/if}}

View file

@ -32,7 +32,12 @@
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<button type="submit" class="btn btn-primary">Sign in</button> or <a href="/users/forgot">Forgot password?</a>
<button type="submit" class="btn btn-primary">Sign in</button> or
{{#if ldap.enabled}}
<a href="{{ldap.passwordresetlink}}">Forgot password?</a>
{{else}}
<a href="/users/forgot">Forgot password?</a>
{{/if}}
</div>
</div>
</form>