Module: Authlogic::Session::Password::InstanceMethods
- Defined in:
- lib/authlogic/session/password.rb
Overview
Password-related instance methods
Constant Summary collapse
- E_AC_PARAMETERS =
" You have passed an ActionController::Parameters to Authlogic 3. That's\n OK for now, but in Authlogic 4, it will raise an error. Please\n replace:\n\n UserSession.new(user_session_params)\n UserSession.create(user_session_params)\n\n with\n\n UserSession.new(user_session_params.to_h)\n UserSession.create(user_session_params.to_h)\n\n And don't forget to `permit`!\n\n During the transition of rails to Strong Parameters, it has been\n common for Authlogic users to forget to `permit` their params. They\n would pass their params into Authlogic, we'd call `to_h`, and they'd\n be surprised when authentication failed.\n\n In 2018, people are still making this mistake. We'd like to help them\n and make authlogic a little simpler at the same time, so in Authlogic\n 3.7.0, we deprecated the use of ActionController::Parameters.\n\n We discussed this issue thoroughly between late 2016 and early\n 2018. Notable discussions include:\n\n - https://github.com/binarylogic/authlogic/issues/512\n - https://github.com/binarylogic/authlogic/pull/558\n - https://github.com/binarylogic/authlogic/pull/577\n".strip_heredoc.freeze
Instance Method Summary collapse
-
#credentials ⇒ Object
Returns the login_field / password_field credentials combination in hash form.
-
#credentials=(value) ⇒ Object
Accepts the login_field / password_field credentials combination in hash form.
- #initialize(*args) ⇒ Object
- #invalid_password? ⇒ Boolean
Instance Method Details
#credentials ⇒ Object
Returns the login_field / password_field credentials combination in hash form.
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/authlogic/session/password.rb', line 174 def credentials if authenticating_with_password? details = {} details[login_field.to_sym] = send(login_field) details[password_field.to_sym] = "<protected>" details else super end end |
#credentials=(value) ⇒ Object
Accepts the login_field / password_field credentials combination in hash form.
187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/authlogic/session/password.rb', line 187 def credentials=(value) super values = parse_param_val(value) # add strong parameters check if values.first.is_a?(Hash) values.first.with_indifferent_access.slice(login_field, password_field).each do |field, value| next if value.blank? send("#{field}=", value) end end end |
#initialize(*args) ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/authlogic/session/password.rb', line 164 def initialize(*args) if !self.class.configured_password_methods configure_password_methods self.class.configured_password_methods = true end super end |
#invalid_password? ⇒ Boolean
199 200 201 |
# File 'lib/authlogic/session/password.rb', line 199 def invalid_password? invalid_password == true end |