5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/helpers/decidim/passwords_helper.rb', line 5
def password_field_options_for(user)
user =
case user
when :user
Decidim::User.new
when :admin
Decidim::User.new(admin: true)
when String
Decidim::User.with_reset_password_token(user)
else
user
end
min_length = ::PasswordValidator.minimum_length_for(user)
help_text =
if needs_admin_password?(user)
t("devise.passwords.edit.password_help_admin", minimun_characters: min_length)
else
t("devise.passwords.edit.password_help", minimun_characters: min_length)
end
{
autocomplete: "new-password",
required: true,
help_text: help_text,
minlength: min_length,
maxlength: ::PasswordValidator::MAX_LENGTH
}
end
|