Use new authenticate_by method

This commit is contained in:
Trevor Vallender 2023-10-20 11:19:09 +01:00
parent 5d0a1b1612
commit 6f32112b2a
1 changed files with 2 additions and 1 deletions

View File

@ -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