Skip to content

Commit 7a480e8

Browse files
committed
Don't actually log the person in in the event that their password has expired. Change 'about to expire' warning to a warning and not an error.
1 parent 201a514 commit 7a480e8

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

  • lib/galaxy/webapps/galaxy/controllers

lib/galaxy/webapps/galaxy/controllers/user.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -562,20 +562,21 @@ def __validate_login( self, trans, **kwd ):
562562
else: # Grace period is off. Login is disabled and user will have the activation email resent.
563563
message, status = self.resend_verification_email( trans, user.email, user.username )
564564
else: # activation is OFF
565-
message, success, status = self.proceed_login( trans, user, redirect )
566565
pw_expires = trans.app.config.password_expiration_period
567-
if pw_expires:
568-
if user.last_password_change < datetime.today() - pw_expires:
569-
trans.response.send_redirect(web.url_for(controller='user',
570-
action='change_password',
571-
message='Your password has expired. Please change it to access Galaxy.',
572-
redirect_home=True,
573-
status='error'))
574-
elif user.last_password_change < datetime.today() - timedelta(days=pw_expires.days / 10):
575-
expiredate = datetime.today() - user.last_password_change + pw_expires
576-
message = 'You are now logged in as %s. Your password will expire in %s days.<br>You can <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
577-
(expiredate.days, user.email, redirect, url_for('/'))
578-
status = 'error'
566+
if pw_expires and user.last_password_change < datetime.today() - pw_expires:
567+
# Password is expired, we don't log them in.
568+
trans.response.send_redirect(web.url_for(controller='user',
569+
action='change_password',
570+
message='Your password has expired. Please change it to access Galaxy.',
571+
redirect_home=True,
572+
status='error'))
573+
message, success, status = self.proceed_login( trans, user, redirect )
574+
if pw_expires and user.last_password_change < datetime.today() - timedelta(days=pw_expires.days / 10):
575+
# If password is about to expire, modify message to state that.
576+
expiredate = datetime.today() - user.last_password_change + pw_expires
577+
message = 'You are now logged in as %s. Your password will expire in %s days.<br>You can <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
578+
(expiredate.days, user.email, redirect, url_for('/'))
579+
status = 'warning'
579580
return ( message, status, user, success )
580581

581582
def proceed_login( self, trans, user, redirect ):

0 commit comments

Comments
 (0)