super_admin: check password complexity client side
This commit is contained in:
parent
90d7ee872e
commit
94b3ec942b
4 changed files with 32 additions and 4 deletions
|
@ -3,4 +3,17 @@ class SuperAdmins::PasswordsController < Devise::PasswordsController
|
|||
super
|
||||
self.resource.disable_otp!
|
||||
end
|
||||
|
||||
def test_strength
|
||||
@score, @words, @length = ZxcvbnService.new(password_params[:password]).complexity
|
||||
@min_length = PASSWORD_MIN_LENGTH
|
||||
@min_complexity = PASSWORD_COMPLEXITY_FOR_ADMIN
|
||||
render 'shared/password/test_strength'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def password_params
|
||||
params.require(:super_admin).permit(:password)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue