Sha256: 3a299d312c6601a07dcd425976daa576303cf67b791a7a7abaea4867b228d9dd

Contents?: true

Size: 924 Bytes

Versions: 5

Compression:

Stored size: 924 Bytes

Contents

module Protected
  module PasswordsHelper
    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" }

    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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
protected-1.0.4 app/helpers/protected/passwords_helper.rb
protected-1.0.3 app/helpers/protected/passwords_helper.rb
protected-1.0.2 app/helpers/protected/passwords_helper.rb
protected-1.0.1 app/helpers/protected/passwords_helper.rb
protected-1.0.0 app/helpers/protected/passwords_helper.rb