aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_controller.rb10
-rw-r--r--app/models/user.rb4
-rw-r--r--todo.txt2
3 files changed, 7 insertions, 9 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
diff --git a/app/models/user.rb b/app/models/user.rb
index 9a4708c57..986d5dc3d 100644
--- a/app/models/user.rb
+++ b/app/models/user.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.rb,v 1.10 2007-10-30 14:23:21 francis Exp $
+# $Id: user.rb,v 1.11 2007-11-01 16:14:43 francis Exp $
require 'digest/sha1'
@@ -26,7 +26,7 @@ class User < ActiveRecord::Base
# Return user given login email and password
def self.authenticate(email, password)
- user = self.find(:first, :conditions => [ 'email like ?', email ] )
+ user = self.find(:first, :conditions => [ 'email ilike ?', email ] ) # using ilike for case insensitive
if user
expected_password = encrypted_password(password, user.salt)
if user.hashed_password != expected_password
diff --git a/todo.txt b/todo.txt
index b4f3ff79b..aaf0a893a 100644
--- a/todo.txt
+++ b/todo.txt
@@ -2,8 +2,6 @@ Online
======
Work out how to do controller/view integrated specs and add some
-Move things from views/user_accounts into views/user
-Replace all find :conditions with find_by_
Next
====