Fix for users with umlauts

This commit is contained in:
Ozzieisaacs
2019-03-03 08:38:36 +01:00
parent 68a36597ab
commit fda977b155
3 changed files with 8 additions and 3 deletions
+5 -1
View File
@@ -36,6 +36,7 @@ import helper
from werkzeug.security import check_password_hash
from werkzeug.datastructures import Headers
from web import download_required
import sys
try:
from urllib.parse import quote
except ImportError:
@@ -300,7 +301,10 @@ def feed_search(term):
return render_xml_template('feed.xml', searchterm="")
def check_auth(username, password):
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == username.lower()).first()
if sys.version_info.major == 3:
username=username.encode('windows-1252')
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) ==
username.decode('utf-8').lower()).first()
return bool(user and check_password_hash(user.password, password))