session creation
This commit is contained in:
parent
0b2bd70f16
commit
f8093d2c09
9 changed files with 63 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue