# HG changeset patch # User Mads Kiilerich # Date 1545861306 -3600 # Node ID 22bc0f7cc2b4a4a44a87e63921f0fc1ceca8b615 # Parent 088155584e2eef83427685db3ab17350d4fcf2ef auth: drop UserCreationError handling for AuthUser.from_cookie Simplify the code a bit, and take an unnecessary concern out of sight. Users with cookie auth must already exist in the system, and they will thus never be created on the fly when using a cookie for authentication. If completely weird things should happen anyway, it would probably be better to get a clear stack trace. diff -r 088155584e2e -r 22bc0f7cc2b4 kallithea/lib/base.py --- a/kallithea/lib/base.py Wed Dec 26 03:03:31 2018 +0100 +++ b/kallithea/lib/base.py Wed Dec 26 22:55:06 2018 +0100 @@ -450,15 +450,7 @@ # v0.3 and earlier included an 'is_authenticated' key; if present, # this must be True. if isinstance(session_authuser, dict) and session_authuser.get('is_authenticated', True): - try: - return AuthUser.from_cookie(session_authuser) - except UserCreationError as e: - # container auth or other auth functions that create users on - # the fly can throw UserCreationError to signal issues with - # user creation. Explanation should be provided in the - # exception object. - from kallithea.lib import helpers as h - h.flash(e, 'error', logf=log.error) + return AuthUser.from_cookie(session_authuser) # Authenticate by auth_container plugin (if enabled) if any(