Module: Protected::PasswordsHelper

Defined in:
app/helpers/protected/passwords_helper.rb

Constant Summary collapse

MESSAGES =
{'match confirmation'      => "Passwords should match confirmation",
'8 characters long'       => "Password should be at least 8 characters long",
'special character'       => "Password should have at least 1 digit, 1 capital letter and 1 special character \(\!\@\#\$\%\^\&\*\(\)\_\-\=\+\)",
'previous five passwords' => "You can not use previous five passwords",
'password token'          => "You must have a valid reset password token" }

Instance Method Summary collapse

Instance Method Details

#message_class(messages, error) ⇒ Object



17
18
19
# File 'app/helpers/protected/passwords_helper.rb', line 17

def message_class(messages, error)
  messages.include?(error) ? "block-message error" : ""
end

#password_instructions(messages) ⇒ Object



9
10
11
12
13
14
15
# File 'app/helpers/protected/passwords_helper.rb', line 9

def password_instructions(messages)
  section = ""
  MESSAGES.each do |error, message|
    section << "<div class=\"alert-message #{ message_class(messages, error) }\">#{message}</div>"
  end
  section.html_safe
end