Files
grecia/app/controllers/management/account_controller.rb
iagirre e8b91356b3 Backend functionality to let managers update users password
The back button when the user changes the password
(in the print password page) redirects to the
edit manually page.

The routes to access password edit pages has been added,
along with the ones to send reset password email and
reset password manually.
2018-04-02 09:43:24 +02:00

35 lines
757 B
Ruby

class Management::AccountController < Management::BaseController
before_action :only_verified_users
def show
end
def edit
end
def print_password
end
def reset_password
managed_user.send_reset_password_instructions
redirect_to management_account_path, notice: t("management.account.edit.password.reset_email_send")
end
def change_password
if managed_user.reset_password(params[:user][:password], params[:user][:password])
session[:new_password] = params[:user][:password]
redirect_to print_password_management_account_path
else
render :edit_password_manually
end
end
private
def only_verified_users
check_verified_user t("management.account.alert.unverified_user")
end
end