session creation

This commit is contained in:
Karol Selak 2021-03-20 20:02:37 +01:00
parent 0b2bd70f16
commit f8093d2c09
9 changed files with 63 additions and 3 deletions

View file

@ -3,6 +3,11 @@ class SessionsController < ApplicationController
end
def create
@user = User.find_by(username: params[:username])
if @user && @user.authenticate(params[:password])
sessions[:user_id] = @user.id
end
redirect_to '/welcome'
end
def welcome