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