mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Simplify the logic to display the minimum password length hint
There's no real need to pass 2 variables to the view to figure that out, we can simply display the message relying on whether or not the `@minimum_password_length` variable is present.
This commit is contained in:
parent
5c5200b5d9
commit
bebf0ecbbe
6 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,9 @@
|
|||
### Unreleased
|
||||
|
||||
* enhancements
|
||||
* The hint about minimum password length required both `@validatable` and `@minimum_password_length`
|
||||
variables on the views, it now uses only the latter. If you have generated the views
|
||||
relying on the `@validatable` variable, replace it with `@minimum_password_length`.
|
||||
* Added an ActiveSupport load hook for `:devise_controller` (by @nakhli)
|
||||
* Location fragments are now preserved between requests (by @jbourassa)
|
||||
* Added an `after_remembered` callback for the Rememerable module (by @BM5k)
|
||||
|
|
|
@ -156,8 +156,7 @@ MESSAGE
|
|||
|
||||
# Sets minimum password length to show to user
|
||||
def set_minimum_password_length
|
||||
@validatable = devise_mapping.validatable?
|
||||
if @validatable
|
||||
if devise_mapping.validatable?
|
||||
@minimum_password_length = resource_class.password_length.min
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<% if @validatable %>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div class="field">
|
||||
<%= f.label :password %>
|
||||
<% if @validatable %>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<%= f.full_error :reset_password_token %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @validatable) %>
|
||||
<%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
|
||||
<%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :email, required: true, autofocus: true %>
|
||||
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @validatable) %>
|
||||
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
|
||||
<%= f.input :password_confirmation, required: true %>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue