changeset 7487:22bc0f7cc2b4

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.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 26 Dec 2018 22:55:06 +0100
parents 088155584e2e
children 6952e88f8ded
files kallithea/lib/base.py
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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(