mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-23 01:16:18 +00:00
Now admins can modify other users passwords
This commit is contained in:
parent
fe5e966dbc
commit
fcf1a83234
@ -130,11 +130,14 @@ def change_password(uid):
|
|||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
user = UserManager.get(store, uid)[1].name
|
user = UserManager.get(store, uid)[1].name
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
current, new, confirm = map(request.form.get, [ 'current', 'new', 'confirm' ])
|
|
||||||
error = False
|
error = False
|
||||||
if current in ('', None):
|
if uid == 'me' or uid == session.get('userid'):
|
||||||
flash('The current password is required')
|
current, new, confirm = map(request.form.get, [ 'current', 'new', 'confirm' ])
|
||||||
error = True
|
if current in ('', None):
|
||||||
|
flash('The current password is required')
|
||||||
|
error = True
|
||||||
|
else:
|
||||||
|
new, confirm = map(request.form.get, [ 'new', 'confirm' ])
|
||||||
if new in ('', None):
|
if new in ('', None):
|
||||||
flash('The new password is required')
|
flash('The new password is required')
|
||||||
error = True
|
error = True
|
||||||
@ -143,10 +146,10 @@ def change_password(uid):
|
|||||||
error = True
|
error = True
|
||||||
|
|
||||||
if not error:
|
if not error:
|
||||||
if uid == 'me':
|
if uid == 'me' or uid == session.get('userid'):
|
||||||
status = UserManager.change_password(store, session.get('userid'), current, new)
|
status = UserManager.change_password(store, session.get('userid'), current, new)
|
||||||
else:
|
else:
|
||||||
status = UserManager.change_password(store, uuid.UUID(uid), current, new)
|
status = UserManager.change_password2(store, UserManager.get(store, uid)[1].name, new)
|
||||||
if status != UserManager.SUCCESS:
|
if status != UserManager.SUCCESS:
|
||||||
flash(UserManager.error_str(status))
|
flash(UserManager.error_str(status))
|
||||||
else:
|
else:
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<h2>{{ user }}</h2>
|
<h2>{{ user }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
{% if session.username == user %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="sr-only" for="current">Current password</label>
|
<label class="sr-only" for="current">Current password</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -45,6 +46,7 @@
|
|||||||
<input type="password" class="form-control" id="current" name="current" placeholder="Current password" />
|
<input type="password" class="form-control" id="current" name="current" placeholder="Current password" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="sr-only" for="new">New password</label>
|
<label class="sr-only" for="new">New password</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user