Merge pull request #2548 from wairbut-m2c/backport-let-manager-reset-users-password

Let managers reset user's password
This commit is contained in:
Raimond Garcia
2018-04-05 17:03:24 +02:00
committed by GitHub
16 changed files with 246 additions and 8 deletions

View File

@@ -5,6 +5,26 @@ class Management::AccountController < Management::BaseController
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

View File

@@ -44,4 +44,8 @@ class Management::BaseController < ActionController::Base
def current_budget
Budget.current
end
def clear_password
session[:new_password] = nil
end
end

View File

@@ -40,6 +40,7 @@ class Management::DocumentVerificationsController < Management::BaseController
def set_document
session[:document_type] = params[:document_verification][:document_type]
session[:document_number] = params[:document_verification][:document_number]
clear_password
end
def clean_document_number

View File

@@ -44,6 +44,7 @@ class Management::UsersController < Management::BaseController
def destroy_session
session[:document_type] = nil
session[:document_number] = nil
clear_password
end
def user_without_email