Skip to content

Commit

Permalink
fix(email): remove redundancy and correctly get email for RAS
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13-machine-user committed Jun 15, 2021
1 parent d22816d commit 2762484
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 125 deletions.
7 changes: 3 additions & 4 deletions fence/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ def set_flask_session_values(user):
if not idp:
idp = IdentityProvider(name=provider)

_update_users_email(user, email)

user.identity_provider = idp
current_session.add(user)
current_session.commit()
Expand Down Expand Up @@ -264,11 +262,12 @@ def admin_login_required(function):
def _update_users_email(user, email):
"""
Update email if provided and doesn't match db entry.
NOTE: This does NOT commit to the db, do so outside this function
"""
if email and user.email != email:
logger.info(
f"Updating username {user.username}'s email from {user.email} to {email}"
)
user.email = email

current_session.add(user)
current_session.commit()
120 changes: 0 additions & 120 deletions fence/resources/audit_service_client.py

This file was deleted.

2 changes: 1 addition & 1 deletion fence/resources/openid/ras_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_user_id(self, code):
self.logger.exception("{}: {}".format(err_msg, e))
return {"error": err_msg}

return {"username": username}
return {"username": username, "email": userinfo.get("email")}

@backoff.on_exception(backoff.expo, Exception, **DEFAULT_BACKOFF_SETTINGS)
def update_user_visas(self, user, db_session=current_session):
Expand Down

0 comments on commit 2762484

Please sign in to comment.