Use new authenticate_by method
This commit is contained in:
parent
5d0a1b1612
commit
6f32112b2a
|
@ -9,7 +9,8 @@ class SessionsController < ApplicationController
|
|||
def new; end
|
||||
|
||||
def create
|
||||
if @user.present? && @user.authenticate(params[:password])
|
||||
@user = User.authenticate_by(username: params[:username], password: params[:password])
|
||||
if @user
|
||||
session[:user_id] = @user.id
|
||||
redirect_to root_path, notice: t(".logged_in")
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue