Fix user with umlauts
pull/836/head
Ozzieisaacs 6 years ago
parent fa276fd0d3
commit 11b770b3fb

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

@ -247,7 +247,7 @@ def load_user_from_header(header_val):
header_val = header_val.replace('Basic ', '', 1)
basic_username = basic_password = ''
try:
header_val = base64.b64decode(header_val)
header_val = base64.b64decode(header_val).decode('utf-8')
basic_username = header_val.split(':')[0]
basic_password = header_val.split(':')[1]
except TypeError:
@ -259,6 +259,8 @@ def load_user_from_header(header_val):
def check_auth(username, password):
if sys.version_info.major == 3:
username=username.encode('windows-1252')
user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == username.lower()).first()
return bool(user and check_password_hash(user.password, password))
@ -726,6 +728,7 @@ def feed_osd():
return render_xml_template('osd.xml', lang='en-EN')
@app.route("/opds/search/", defaults={'query': ""})
@app.route("/opds/search/<query>")
@requires_basic_auth_if_no_ano
def feed_cc_search(query):

Loading…
Cancel
Save