blob: a0564984c01889a521ab25aafcab1ca7939134ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
class SessionsController < ApplicationController
skip_before_action :authorize!, only: [:new, :create]
def new
@user = User.new
end
def create
user = User.find_by(username: params[:username])
if user && user.authenticate(params[:password])
session[:x] = user.id
redirect_to agents_path
else
redirect_to new_session_path
end
end
def destroy
reset_session
redirect_to new_session_path
end
end
|