#3928 different pwd edit page for administrators
This commit is contained in:
parent
3bf32b6d43
commit
220b38ad2a
1 changed files with 25 additions and 3 deletions
|
@ -8,9 +8,19 @@ class Users::PasswordsController < Devise::PasswordsController
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# POST /resource/password
|
# POST /resource/password
|
||||||
# def create
|
def create
|
||||||
# super
|
# Check the credentials associated to the mail to generate a correct reset link
|
||||||
# end
|
email = params[:user][:email]
|
||||||
|
if Administrateur.find_by(email: email)
|
||||||
|
@devise_mapping = Devise.mappings[:administrateur]
|
||||||
|
params[:administrateur] = params[:user]
|
||||||
|
# uncomment to check password complexity for Gestionnaire
|
||||||
|
# elsif Gestionnaire.find_by(email: email)
|
||||||
|
# @devise_mapping = Devise.mappings[:gestionnaire]
|
||||||
|
# params[:gestionnaire] = params[:user]
|
||||||
|
end
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
# GET /resource/password/edit?reset_password_token=abcdef
|
# GET /resource/password/edit?reset_password_token=abcdef
|
||||||
# def edit
|
# def edit
|
||||||
|
@ -19,6 +29,7 @@ class Users::PasswordsController < Devise::PasswordsController
|
||||||
|
|
||||||
# PUT /resource/password
|
# PUT /resource/password
|
||||||
# def update
|
# def update
|
||||||
|
# # params[:user][:password_confirmation] = params[:user][:password]
|
||||||
# super
|
# super
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
@ -52,4 +63,15 @@ class Users::PasswordsController < Devise::PasswordsController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_strength
|
||||||
|
@score, @words, @length = ZxcvbnService.new(password_params[:password]).complexity
|
||||||
|
@min_length = PASSWORD_MIN_LENGTH
|
||||||
|
@min_complexity = PASSWORD_COMPLEXITY_FOR_USER
|
||||||
|
render 'shared/password/test_strength'
|
||||||
|
end
|
||||||
|
|
||||||
|
def password_params
|
||||||
|
params.require(:user).permit(:reset_password_token, :password)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue