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 new; end
|
||||||
|
|
||||||
def create
|
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
|
session[:user_id] = @user.id
|
||||||
redirect_to root_path, notice: t(".logged_in")
|
redirect_to root_path, notice: t(".logged_in")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue