Skip to content

Commit

Permalink
If unable to send reset email, give admin the link to provide user
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-wahl committed Feb 6, 2024
1 parent c0aa4c7 commit bf3b7f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion webtool/views/views_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,13 @@ def add_user():
"message": "A new registration e-mail has been sent to %s. The registration link is [%s](%s)" % (
username, url, url)}}
except RuntimeError as e:
# Grab the token and provide it to the admin, so they can send to user
new_token = user.generate_token()
url_base = config.get("flask.server_name")
protocol = "https" if config.get("flask.https") else "http"
url = "%s://%s/reset-password/?token=%s" % (protocol, url_base, new_token)
response = {**response, **{
"message": "Token was reset but registration e-mail could not be sent (%s)." % e}}
"message": "Token was reset but registration e-mail could not be sent (%s). Reset password link: [%s](%s)" % (e, url, url)}}

if fmt == "html":
if redirect_to_page:
Expand Down

0 comments on commit bf3b7f6

Please sign in to comment.