forked from ScoDoc/ScoDoc
Reset password: mail case insensitive
This commit is contained in:
parent
1d4b328a8e
commit
9a6d5761ee
@ -6,6 +6,7 @@ auth.routes.py
|
||||
from flask import current_app, flash, render_template
|
||||
from flask import redirect, url_for, request
|
||||
from flask_login import login_user, logout_user, current_user
|
||||
from sqlalchemy import func
|
||||
|
||||
from app import db
|
||||
from app.auth import bp
|
||||
@ -79,18 +80,18 @@ def reset_password_request():
|
||||
return redirect(url_for("scodoc.index"))
|
||||
form = ResetPasswordRequestForm()
|
||||
if form.validate_on_submit():
|
||||
users = User.query.filter_by(email=form.email.data).all()
|
||||
users = User.query.filter(
|
||||
func.lower(User.email) == func.lower(form.email.data)
|
||||
).all()
|
||||
if len(users) == 1:
|
||||
send_password_reset_email(users[0])
|
||||
elif len(users) > 1:
|
||||
current_app.logger.info(
|
||||
"reset_password_request: multiple users with email '{}' (ignoring)".format(
|
||||
form.email.data
|
||||
)
|
||||
f"reset_password_request: multiple users with email '{form.email.data}' (ignoring)"
|
||||
)
|
||||
else:
|
||||
current_app.logger.info(
|
||||
"reset_password_request: for unkown user '{}'".format(form.email.data)
|
||||
f"reset_password_request: for unkown user '{form.email.data}'"
|
||||
)
|
||||
flash(
|
||||
_("Voir les instructions envoyées par mail (pensez à regarder vos spams)")
|
||||
|
@ -197,7 +197,7 @@ class BaseArchiver(object):
|
||||
"""returns archive id (check that name is valid)"""
|
||||
self.initialize()
|
||||
if not self.is_valid_archive_name(archive_name):
|
||||
raise ValueError("invalid archive name")
|
||||
raise ScoValueError(f"Archive {archive_name} introuvable")
|
||||
archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
|
||||
if not os.path.isdir(archive_id):
|
||||
log(
|
||||
|
Loading…
Reference in New Issue
Block a user