Permalink
Browse files

Changing email addresses to lower case

  • Loading branch information...
1 parent 90dea48 commit 501d9483da0cd801e9cdb39d08602467dc269ef5 @michaelcamilleri michaelcamilleri committed Jul 23, 2012
Showing with 6 additions and 4 deletions.
  1. +4 −2 app/controllers/players_controller.rb
  2. +2 −2 app/controllers/sessions_controller.rb
@@ -45,6 +45,7 @@ def password
# POST /player.xml
def create
@player = Player.new(params[:player])
+ @player.email = @player.email.downcase
# Get player coordinates and location
#@client_ip = request.remote_ip
@@ -98,9 +99,10 @@ def update
player_params = params[:player].stringify_keys
player_params.each do |key,value|
if key.eql? "email"
- @player_params_email = value
+ params[:player]["email"] = value.downcase
+ @player_params_email = value.downcase
elsif key.eql? "mobile"
- @player_params_mobile = value
+ @player_params_mobile = value
elsif key.eql? "password"
if ((!params[:old_password].nil?) && (!Digest::SHA2.hexdigest(@player.id.to_s() + params[:old_password]).eql?@player.password))
@player.errors.add("old_password", "Incorrect password")
@@ -3,7 +3,7 @@ class SessionsController < ApplicationController
# method called upon clicking Play button
def login
- email = params[:email]
+ email = params[:email].downcase
password = params[:password]
player = Player.get_player(email)
@@ -21,7 +21,7 @@ def login
if password != player.password and !password.blank?
flash.now[:error] = "Incorrect username and password combination"
elsif !password.nil? and password.empty?
- flash.now[:error] = "password empty"
+ flash.now[:error] = "Empty password"
elsif password == player.password
session[:logged_in_player] = player
end

0 comments on commit 501d948

Please sign in to comment.