Create User Model

rails generate model User email:string password_digest:string

Add has_secure_password module to User model

class User < ActiveRecord::Base
  has_secure_password
end

Now you can create a new user with password

user = User.new email: '[email protected]', password: 'Password1', password_confirmation: 'Password1'

Verify password with authenticate method

user.authenticate('somepassword')

results matching ""

    No results matching ""