Use NULL for non-existant passwords

This commit is contained in:
rubenwardy
2020-12-04 22:35:22 +00:00
parent a8537659e2
commit bfcdd642fd
4 changed files with 41 additions and 7 deletions

View File

@@ -73,7 +73,7 @@ def callback(oauth_token):
flash("Unable to find an account for that Github user", "danger")
return redirect(url_for("users.claim"))
elif loginUser(userByGithub):
if not current_user.hasPassword():
if not current_user.password:
return redirect(next_url or url_for("users.set_password", optional=True))
else:
return redirect(next_url or url_for("homepage.home"))

View File

@@ -143,7 +143,7 @@ def change_password():
@bp.route("/user/set-password/", methods=["GET", "POST"])
@login_required
def set_password():
if current_user.hasPassword():
if current_user.password:
return redirect(url_for("users.change_password"))
form = SetPasswordForm(request.form)