Browse Source

feat: add password hint_text

pull/1265/head
natdeanlewissoftwire 3 years ago
parent
commit
04cbda32e4
  1. 6
      app/controllers/auth/passwords_controller.rb
  2. 2
      app/views/devise/passwords/edit.html.erb
  3. 2
      app/views/devise/passwords/reset_password.html.erb

6
app/controllers/auth/passwords_controller.rb

@ -24,11 +24,13 @@ class Auth::PasswordsController < Devise::PasswordsController
def edit
super
minimum_password_length
@confirmation = params["confirmation"]
render "devise/passwords/reset_password"
end
def update
minimum_password_length
self.resource = resource_class.reset_password_by_token(resource_params)
yield resource if block_given?
@ -51,6 +53,10 @@ class Auth::PasswordsController < Devise::PasswordsController
protected
def minimum_password_length
@minimum_password_length ||= Devise.password_length.min
end
def set_2fa_required
return unless resource.respond_to?(:need_two_factor_authentication?) &&
resource.need_two_factor_authentication?(request)

2
app/views/devise/passwords/edit.html.erb

@ -15,7 +15,7 @@
<%= f.govuk_password_field :password,
label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
hint: { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." },
autocomplete: "new-password" %>
<%= f.govuk_password_field :password_confirmation,

2
app/views/devise/passwords/reset_password.html.erb

@ -16,7 +16,7 @@
<%= f.govuk_password_field :password,
label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
hint: { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." },
autocomplete: "new-password" %>
<%= f.govuk_password_field :password_confirmation,

Loading…
Cancel
Save