GRN2-xx: Restructured email verification and password reset (#1444)

* Restructured email verification and password reset

* Fixed issue with password reset

Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
Ahmad Farhat
2020-04-29 17:56:46 -04:00
committed by GitHub
parent 8f3ba8a038
commit 28302107bd
10 changed files with 46 additions and 81 deletions

View File

@ -88,10 +88,7 @@ class SessionsController < ApplicationController
# Check that the user is a Greenlight account
return redirect_to(root_path, alert: I18n.t("invalid_login_method")) unless user.greenlight_account?
# Check that the user has verified their account
unless user.activated?
user.create_activation_token
return redirect_to(account_activation_path(token: user.activation_token))
end
return redirect_to(account_activation_path(token: user.create_activation_token)) unless user.activated?
end
login(user)
@ -247,8 +244,7 @@ class SessionsController < ApplicationController
logger.info "Switching social account to local account for #{user.uid}"
# Send the user a reset password email
user.create_reset_digest
send_password_reset_email(user)
send_password_reset_email(user, user.create_reset_digest)
# Overwrite the flash with a more descriptive message if successful
flash[:success] = I18n.t("reset_password.auth_change") if flash[:success].present?