Inloggen (ook CalDAV) niet hoofdlettergevoelig: het ingevoerde e-mailadres gaat in kleine letters, zoals het wordt opgeslagen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Machiel
2026-10-16 18:34:55 +02:00
co-authored by Claude Opus 5.5
parent cad838f1f4
commit 3cf53bc248
+2 -2
View File
@@ -616,7 +616,7 @@ def setup():
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])
def login(): def login():
if request.method == 'POST': if request.method == 'POST':
user = q1('SELECT * FROM users WHERE email=? AND active=1', request.form.get('email', '').strip()) user = q1('SELECT * FROM users WHERE email=? AND active=1', request.form.get('email', '').strip().lower())
if user and check_password_hash(user['password_hash'], request.form.get('password', '')): if user and check_password_hash(user['password_hash'], request.form.get('password', '')):
session.pop('portal_cid', None) session.pop('portal_cid', None)
session['uid'] = user['id'] session['uid'] = user['id']
@@ -3339,7 +3339,7 @@ def dav_user():
auth = request.authorization auth = request.authorization
if not auth or (auth.type or '').lower() != 'basic' or not auth.username: if not auth or (auth.type or '').lower() != 'basic' or not auth.username:
return None return None
u = q1('SELECT * FROM users WHERE email=? AND active=1', auth.username.strip()) u = q1('SELECT * FROM users WHERE email=? AND active=1', auth.username.strip().lower())
if u and u['dav_password_hash'] and check_password_hash(u['dav_password_hash'], auth.password or ''): if u and u['dav_password_hash'] and check_password_hash(u['dav_password_hash'], auth.password or ''):
return u return u
return None return None