def pw_reset(username):
    if current_user.username == username or current_user.has_role('admin'):
        current_user.reset_password()
        flash("Passort was reset")
        next=request.args.get("next", None)
        return redirect(next)
    else:
        abort(403)
def pw_reset(username):
    if current_user.username == username or current_user.has_role('admin'):
        current_user.reset_password()
        flash("Passort was reset")
        next = request.args.get("next", None)
        return redirect(next)
    else:
        abort(403)
Exemple #3
0
def account_settings():
	if request.method == 'POST':
		if request.form.get('current-password'): # user is asking to change their password

			current = request.form.get('current-password')
			new = request.form.get('new-password')
			repeatnew = request.form.get('repeat-new-password')

			if not current_user.check_password(current):
				flash("Current password does not match.", 'error')
				return redirect(url_for('account_settings'))
			if new != repeatnew:
				flash("The passwords do not match.", 'error')
				return redirect(url_for('account_settings'))

			current_user.reset_password(new)
			g.UserManager.save_user(current_user)
			flash('Password changed successfully!', 'success')
			return redirect(url_for('account_settings'))

	return render_template('account/settings.html')
Exemple #4
0
def account_settings():
	if request.method == 'POST':
		if request.form.get('current-password'): # user is asking to change their password

			current = request.form.get('current-password')
			new = request.form.get('new-password')
			repeatnew = request.form.get('repeat-new-password')

			if not current_user.check_password(current):
				flash("Current password does not match.", 'error')
				return redirect(url_for('account_settings'))
			if new != repeatnew:
				flash("The passwords do not match.", 'error')
				return redirect(url_for('account_settings'))

			current_user.reset_password(new)
			UserManager.save_user(current_user)
			flash('Password changed successfully!', 'success')
			return redirect(url_for('account_settings'))

	return render_template('account/settings.html')