logout
This commit is contained in:
parent
f8093d2c09
commit
7412853a3e
4 changed files with 18 additions and 3 deletions
|
@ -5,11 +5,16 @@ class SessionsController < ApplicationController
|
|||
def create
|
||||
@user = User.find_by(username: params[:username])
|
||||
if @user && @user.authenticate(params[:password])
|
||||
sessions[:user_id] = @user.id
|
||||
session[:user_id] = @user.id
|
||||
end
|
||||
redirect_to '/welcome'
|
||||
end
|
||||
|
||||
def delete
|
||||
session.delete(:user_id)
|
||||
redirect_to '/welcome'
|
||||
end
|
||||
|
||||
def welcome
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue