summaryrefslogtreecommitdiff
path: root/app/controllers/sessions_controller.rb
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 19:56:33 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-06 19:56:33 -0500
commita1700f50ee800cfbfb93bd7dfff7b5d79ae2cb2f (patch)
treec9db0b8bdd4818f5ce2ff982657e2aedfda98f8f /app/controllers/sessions_controller.rb
parent706392b7c4520382ddd8f827b31205c6b71f5320 (diff)
parent63830b0f939db5f6911218950525428420c4d467 (diff)
Merge branch 'master2'
Conflicts: app/controllers/tournaments_controller.rb app/models/tournament.rb app/views/tournaments/_selected.html.erb app/views/tournaments/new.html.erb config/routes.rb
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r--app/controllers/sessions_controller.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index b5ea29b..7cb16e8 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -11,7 +11,8 @@ class SessionsController < ApplicationController
# POST /sessions.json
def create
# find the user...
- @user = User.find_by(email: params[:session][:email].downcase)
+ @user = User.find_by_email(params[:session][:username_or_email]) || User.find_by_user_name(params[:session][:username_or_email])
+
#@session = Session.new(@user)
# ... and create a new session
respond_to do |format|
@@ -39,13 +40,13 @@ class SessionsController < ApplicationController
private
- # Use callbacks to share common setup or constraints between actions.
- def set_session
- #@session = Session.find(cookies[:remember_token])
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_session
+ #@session = Session.find(cookies[:remember_token])
+ end
- # Never trust parameters from the scary internet, only allow the white list through.
- def session_params
- params.require(:session).permit(:session_email, :session_password)
- end
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def session_params
+ params.require(:session).permit(:session_email, :session_user_name, :session_password)
+ end
end