Skip to content

Commit

Permalink
Merge pull request #270 from Royal-Society-of-New-Zealand/ORCIDHUB-209
Browse files Browse the repository at this point in the history
allow login for existing users...
  • Loading branch information
nad2000 authored Oct 10, 2017
2 parents d9962f0 + b405e20 commit c06f06b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions authcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,6 @@ def handle_login():
app.logger.info(
f"the user has logged in with secondary email addresses: {secondary_emails}")

if ENV != "dev" and not (unscoped_affiliation & {"faculty", "staff", "student"}):
flash(
f"Access Denied! Your account (email: {email}, eppn: {eppn}) is not affiliated with '{shib_org_name}'",
"danger")
return redirect(url_for("login"))

except Exception as ex:
app.logger.exception("Failed to login via TUAKIRI.")
abort(500, ex)
Expand Down Expand Up @@ -266,6 +260,13 @@ def handle_login():
if not user.eppn and eppn:
user.eppn = eppn
else:

if ENV != "dev" and not (unscoped_affiliation & {"faculty", "staff", "student"}):
flash(
f"Access Denied! Your account (email: {email}, eppn: {eppn}) is not affiliated with '{shib_org_name}'",
"danger")
return redirect(url_for("login"))

user = User.create(
email=email,
eppn=eppn,
Expand Down

0 comments on commit c06f06b

Please sign in to comment.