From fda977b155bc109a3e8bcaeef2d8e33b964192d9 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 3 Mar 2019 08:38:36 +0100 Subject: [PATCH] Fix for users with umlauts --- cps/opds.py | 6 +++++- cps/templates/osd.xml | 2 +- cps/web.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cps/opds.py b/cps/opds.py index b8df53ba..8f718a0d 100644 --- a/cps/opds.py +++ b/cps/opds.py @@ -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)) diff --git a/cps/templates/osd.xml b/cps/templates/osd.xml index 7ddde953..5c35b764 100644 --- a/cps/templates/osd.xml +++ b/cps/templates/osd.xml @@ -6,7 +6,7 @@ Janeczku https://github.com/janeczku/calibre-web + template="{{url_for('opds.feed_cc_search')}}{searchTerms}"/> open diff --git a/cps/web.py b/cps/web.py index 87685d07..0d4fca1d 100644 --- a/cps/web.py +++ b/cps/web.py @@ -46,6 +46,7 @@ from cps import lm, babel, ub, config, get_locale, language_table, app, db from pagination import Pagination from sqlalchemy.sql.expression import text + feature_support = dict() try: from oauth_bb import oauth_check, register_user_with_oauth, logout_oauth_user, get_oauth_status @@ -1349,7 +1350,7 @@ def login(): def logout(): if current_user is not None and current_user.is_authenticated: logout_user() - if feature_support['oauth']: + if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3): logout_oauth_user() return redirect(url_for('web.login'))