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

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))

View File

@ -6,7 +6,7 @@
<Developer>Janeczku</Developer>
<Contact>https://github.com/janeczku/calibre-web</Contact>
<Url type="text/html"
template="{{url_for('opds.feed_cc_search')}}?query={searchTerms}"/>
template="{{url_for('opds.feed_cc_search')}}{searchTerms}"/>
<Url type="application/atom+xml"
template="{{url_for('opds.feed_normal_search')}}?query={searchTerms}"/>
<SyndicationRight>open</SyndicationRight>

View File

@ -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'))