1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 20:59:59 +00:00

Update routes.py

This commit is contained in:
UnKnoWn 2017-05-18 04:37:22 +08:00 committed by GitHub
parent a1e90c96d9
commit 2ef053dec8

View file

@ -459,7 +459,7 @@ def profile():
return flask.redirect('/profile') return flask.redirect('/profile')
user.email = form.email.data user.email = form.email.data
flask.flash(flask.Markup( flask.flash(flask.Markup(
'<strong>Email successfully changed!</strong>'), 'info') '<strong>Email successfully changed!</strong>'), 'success')
if new_password: if new_password:
if form.current_password.data != user.password_hash: if form.current_password.data != user.password_hash:
flask.flash(flask.Markup( flask.flash(flask.Markup(
@ -467,7 +467,7 @@ def profile():
return flask.redirect('/profile') return flask.redirect('/profile')
user.password_hash = form.new_password.data user.password_hash = form.new_password.data
flask.flash(flask.Markup( flask.flash(flask.Markup(
'<strong>Password successfully changed!</strong>'), 'info') '<strong>Password successfully changed!</strong>'), 'success')
db.session.add(user) db.session.add(user)
db.session.commit() db.session.commit()
@ -475,9 +475,11 @@ def profile():
flask.g.user = user flask.g.user = user
return flask.redirect('/profile') return flask.redirect('/profile')
current_email = models.User.by_id(flask.g.user.id).email _user = models.User.by_id(flask.g.user.id)
username = _user.username
current_email = _user.email
return flask.render_template('profile.html', form=form, email=current_email, level=level) return flask.render_template('profile.html', form=form, name=username, email=current_email, level=level)
@app.route('/user/activate/<payload>') @app.route('/user/activate/<payload>')