move add_user call for new users to login_user

previous location was in a non-awaitable call
This commit is contained in:
Min RK
2018-02-07 11:22:47 +01:00
parent 4cf9ecc819
commit fbdeb4c386

View File

@@ -410,7 +410,10 @@ class BaseHandler(RequestHandler):
username = authenticated['name'] username = authenticated['name']
auth_state = authenticated.get('auth_state') auth_state = authenticated.get('auth_state')
admin = authenticated.get('admin') admin = authenticated.get('admin')
new_user = username not in self.users
user = self.user_from_username(username) user = self.user_from_username(username)
if new_user:
yield gen.maybe_future(self.authenticator.add_user(user))
# Only set `admin` if the authenticator returned an explicit value. # Only set `admin` if the authenticator returned an explicit value.
if admin is not None and admin != user.admin: if admin is not None and admin != user.admin:
user.admin = admin user.admin = admin