method

authenticate

rails latest stable - Class: ActiveModel::SecurePassword::InstanceMethodsOnActivation

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

authenticate(unencrypted_password)
public

Returns self if the password is correct, otherwise false.

class User < ActiveRecord::Base
  has_secure_password validations: false
end

user = User.new(name: 'david', password: 'mUc3m00RsqyRe')
user.save
user.authenticate('notright')      # => false
user.authenticate('mUc3m00RsqyRe') # => user