Sign associated user/gestionnaire in after password change
This commit is contained in:
parent
c2068d055d
commit
45e14d7a43
4 changed files with 76 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
class Users::PasswordsController < Devise::PasswordsController
|
||||
after_action :try_to_authenticate_gestionnaire, only: %i(update)
|
||||
|
||||
# GET /resource/password/new
|
||||
# def new
|
||||
# super
|
||||
|
@ -29,4 +31,11 @@ class Users::PasswordsController < Devise::PasswordsController
|
|||
# def after_sending_reset_password_instructions_path_for(resource_name)
|
||||
# super(resource_name)
|
||||
# end
|
||||
|
||||
def try_to_authenticate_gestionnaire
|
||||
if user_signed_in?
|
||||
gestionnaire = Gestionnaire.find_by(email: current_user.email)
|
||||
sign_in gestionnaire if gestionnaire
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue