diff options
author | francis <francis> | 2007-11-01 16:14:43 +0000 |
---|---|---|
committer | francis <francis> | 2007-11-01 16:14:43 +0000 |
commit | 39f4a8cbfa732dad0cc705761bec526de2a4df72 (patch) | |
tree | 918d1ed049e1c0a855a1591b7a8de5a28686b182 /app/controllers/user_controller.rb | |
parent | ca07ef49192ee73846d1ae658852e739b36c5833 (diff) |
Look at all the find statements with :conditions and check can't
use find_by_<col> instead. Fixed bugs in case sensitivity of email
checking.
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 4ca87437e..6c950e7ba 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_controller.rb,v 1.9 2007-11-01 15:18:54 francis Exp $ +# $Id: user_controller.rb,v 1.10 2007-11-01 16:14:43 francis Exp $ class UserController < ApplicationController # XXX See controllers/application.rb simplify_url_part for reverse of expression in SQL below @@ -23,7 +23,7 @@ class UserController < ApplicationController if not params[:user] # First time page is shown - render :template => 'signin' + render :action => 'signin' return else @user = User.authenticate(params[:user][:email], params[:user][:password]) @@ -34,11 +34,11 @@ class UserController < ApplicationController do_post_redirect post_redirect.uri, post_redirect.post_params return else - if User.find(:first, :conditions => [ "email = ?", params[:user][:email] ]) + if User.find(:first, :conditions => [ "email ilike ?", params[:user][:email] ]) # using like for case insensitive # Failed to authenticate flash[:error] = "Password not correct, please try again" @user = User.new(params[:user]) - render :template => 'signin' + render :action => 'signin' return else # Create a new account @@ -59,7 +59,7 @@ class UserController < ApplicationController @first_time = params[:first_time] @user.errors.clear if @first_time # Show the form - render :template => 'signup' + render :action => 'signup' else # New user made, redirect back to where we were session[:user] = @user.id |