diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/sessions_controller.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..baf8679 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,17 @@ +class SessionsController < ApplicationController + 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 + end +end |
