Fix for users with umlauts
This commit is contained in:
		
							parent
							
								
									68a36597ab
								
							
						
					
					
						commit
						fda977b155
					
				| 
						 | 
					@ -36,6 +36,7 @@ import helper
 | 
				
			||||||
from werkzeug.security import check_password_hash
 | 
					from werkzeug.security import check_password_hash
 | 
				
			||||||
from werkzeug.datastructures import Headers
 | 
					from werkzeug.datastructures import Headers
 | 
				
			||||||
from web import download_required
 | 
					from web import download_required
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    from urllib.parse import quote
 | 
					    from urllib.parse import quote
 | 
				
			||||||
except ImportError:
 | 
					except ImportError:
 | 
				
			||||||
| 
						 | 
					@ -300,7 +301,10 @@ def feed_search(term):
 | 
				
			||||||
        return render_xml_template('feed.xml', searchterm="")
 | 
					        return render_xml_template('feed.xml', searchterm="")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_auth(username, password):
 | 
					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))
 | 
					    return bool(user and check_password_hash(user.password, password))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
   <Developer>Janeczku</Developer>
 | 
					   <Developer>Janeczku</Developer>
 | 
				
			||||||
   <Contact>https://github.com/janeczku/calibre-web</Contact>
 | 
					   <Contact>https://github.com/janeczku/calibre-web</Contact>
 | 
				
			||||||
   <Url type="text/html"
 | 
					   <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"
 | 
					   <Url type="application/atom+xml"
 | 
				
			||||||
        template="{{url_for('opds.feed_normal_search')}}?query={searchTerms}"/>
 | 
					        template="{{url_for('opds.feed_normal_search')}}?query={searchTerms}"/>
 | 
				
			||||||
   <SyndicationRight>open</SyndicationRight>
 | 
					   <SyndicationRight>open</SyndicationRight>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,7 @@ from cps import lm, babel, ub, config, get_locale, language_table, app, db
 | 
				
			||||||
from pagination import Pagination
 | 
					from pagination import Pagination
 | 
				
			||||||
from sqlalchemy.sql.expression import text
 | 
					from sqlalchemy.sql.expression import text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
feature_support = dict()
 | 
					feature_support = dict()
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    from oauth_bb import oauth_check, register_user_with_oauth, logout_oauth_user, get_oauth_status
 | 
					    from oauth_bb import oauth_check, register_user_with_oauth, logout_oauth_user, get_oauth_status
 | 
				
			||||||
| 
						 | 
					@ -1349,7 +1350,7 @@ def login():
 | 
				
			||||||
def logout():
 | 
					def logout():
 | 
				
			||||||
    if current_user is not None and current_user.is_authenticated:
 | 
					    if current_user is not None and current_user.is_authenticated:
 | 
				
			||||||
        logout_user()
 | 
					        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()
 | 
					            logout_oauth_user()
 | 
				
			||||||
    return redirect(url_for('web.login'))
 | 
					    return redirect(url_for('web.login'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user