From ab6480a4b494d4aae1ea441120d5a2c9cbb831c8 Mon Sep 17 00:00:00 2001 From: Nick Douma Date: Fri, 6 Mar 2020 13:49:22 +0100 Subject: [PATCH] Update user with info from oidc during login --- powerdnsadmin/routes/index.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/powerdnsadmin/routes/index.py b/powerdnsadmin/routes/index.py index bc84b81..354ac1d 100644 --- a/powerdnsadmin/routes/index.py +++ b/powerdnsadmin/routes/index.py @@ -297,11 +297,17 @@ def login(): firstname=oidc_givenname, lastname=oidc_familyname, email=oidc_email) - result = user.create_local_user() - if not result['status']: - session.pop('oidc_token', None) - return redirect(url_for('index.login')) + else: + user.firstname = oidc_givenname + user.lastname = oidc_familyname + user.email = oidc_email + user.plain_text_password = None + result = user.update_local_user() + + if not result['status']: + session.pop('oidc_token', None) + return redirect(url_for('index.login')) session['user_id'] = user.id session['authentication_type'] = 'OAuth'