Allow users to edit their own settings
Also, don't use the flash anymore for going back to the referer.
This commit is contained in:
@ -1,23 +0,0 @@
|
||||
[% WRAPPER layout.tt title="Change password" %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
<form action="[% c.uri_for('/change-password/submit') %]" method="post">
|
||||
|
||||
<h2>Change password</h2>
|
||||
|
||||
<table class="info-table">
|
||||
<tr>
|
||||
<th>Enter password:</th>
|
||||
<td><input type="password" class="string" id="password" name="password" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Enter password again:</th>
|
||||
<td><input type="password" class="string" id="password_check" name="password_check" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><button type="submit"><img src="/static/images/success.gif" />Change</button></p>
|
||||
|
||||
</form>
|
||||
|
||||
[% END %]
|
@ -202,7 +202,7 @@
|
||||
<ul class="nav" id="top-menu">
|
||||
|
||||
[% IF c.user_exists %]
|
||||
[% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('preferences')) title = "Preferences" %]
|
||||
[% INCLUDE makeLink uri = c.uri_for(c.controller('User').action_for('edit'), [c.user.username]) title = "Preferences" %]
|
||||
[% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('logout')) title = "Sign out" %]
|
||||
[% ELSE %]
|
||||
[% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('login')) title = "Sign in" %]
|
||||
|
@ -1,4 +1,4 @@
|
||||
[% WRAPPER layout.tt title=(create ? "Register new user" : "User $user.username") %]
|
||||
[% WRAPPER layout.tt title=(create ? "Register new user" : "Editing user $user.username") %]
|
||||
[% PROCESS common.tt %]
|
||||
|
||||
[% BLOCK roleoption %]
|
||||
@ -61,7 +61,7 @@
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="enabled" [% IF 1; 'checked="checked"'; END %]></input>Receive evaluation error notifications
|
||||
<input type="checkbox" name="emailonerror" [% IF emailonerror; 'checked="checked"'; END %]></input>Receive evaluation error notifications
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -99,6 +99,30 @@
|
||||
<i class="icon-ok icon-white"></i>
|
||||
[%IF create %]Create[% ELSE %]Apply changes[% END %]
|
||||
</button>
|
||||
[% IF !create && c.check_user_roles('admin') %]
|
||||
<button id="reset-password" type="submit" class="btn btn-warning" name="submit" value="reset-password">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
Reset password
|
||||
</button>
|
||||
<script type="text/javascript">
|
||||
$("#reset-password").click(function() {
|
||||
bootbox.confirm(
|
||||
'Are you sure you want to reset the password for this user?',
|
||||
function(c) {
|
||||
if (!c) return;
|
||||
$.post("[% c.uri_for(c.controller('User').action_for('edit'), [user.username]) %]", { submit: 'reset-password' })
|
||||
.done(function(data) {
|
||||
if (data.error)
|
||||
bootbox.alert("Unable to reset password: " + data.error);
|
||||
else
|
||||
bootbox.alert("An email containing the new password has been sent to the user.");
|
||||
})
|
||||
.fail(function() { bootbox.alert("Server request failed!"); });
|
||||
});
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
[% IF !create %]
|
||||
<button id="delete-user" type="submit" class="btn btn-danger" name="submit" value="delete">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
|
@ -9,24 +9,22 @@
|
||||
<th>Email</th>
|
||||
<th>Roles</th>
|
||||
<th>Eval. notifications</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH u IN users %]
|
||||
<tr>
|
||||
<td><a class="row-link" href="[% c.uri_for(c.controller('Admin').action_for('user_edit'), [u.username]) %]">[% u.username %]</a></td>
|
||||
<td><a class="row-link" href="[% c.uri_for(c.controller('User').action_for('edit'), [u.username]) %]">[% u.username %]</a></td>
|
||||
<td>[% u.fullname %]</td>
|
||||
<td>[% u.emailaddress %]</td>
|
||||
<td>[% FOREACH r IN u.userroles %]<i>[% r.role %]</i> [% END %]</td>
|
||||
<td>[% IF u.emailonerror %]Yes[% ELSE %]No[% END %]</td>
|
||||
<td>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('reset_password'), [u.username]) content = "Reset password" confirmmsg = "Are you sure you want to reset the password for this user?" class = "btn btn-mini" %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><a class="btn" href="[% c.uri_for(c.controller('Admin').action_for('create_user')) %]">
|
||||
<p><a class="btn" href="[% c.uri_for(c.controller('Root').action_for('register')) %]">
|
||||
<i class="icon-plus"></i> Add a new user
|
||||
</a></p>
|
||||
|
||||
|
Reference in New Issue
Block a user