diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-03 23:52:39 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-03 23:52:39 -0500 |
commit | acb5be88f394b126c3fba48ceb9798403c5afae1 (patch) | |
tree | d28ba5b07bc91cb92f02c9e490bff5501859e6fd /app/controllers | |
parent | 9f246b9ec386ccb5e6665408d050cf71fc336283 (diff) | |
parent | ec9b2d4f40bd6a878aeca3ca32ba2aafe3836da5 (diff) |
Merge branch 'master' of github.com:LukeShu/leager
Conflicts:
app/controllers/users_controller.rb
app/views/users/index.html.erb
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/sessions_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 68cb949..3417332 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,22 +1,25 @@ class SessionsController < ApplicationController def new + if @user.nil? + @user = User.new + end end # find the user and create a new session def create - user = User.find_by(email: params[:session][:email].downcase) - if user && user.authenticate(params[:session][:password]) - sign_in user + @user = User.find_by(email: params[:session][:email].downcase) + if @user && @user.authenticate(params[:session][:password]) + sign_in @user redirect_to root_path else - render 'new' - end + redirect_to signin_path + end end def destroy - sign_out - redirect_to root_path + sign_out + redirect_to root_path end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f540dde..284892b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,7 +10,7 @@ class UsersController < ApplicationController # GET /users/1 # GET /users/1.json def show - @user = User.find(param[:id]) + @user = User.find(params[:id]) end # GET /users/new |