aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/user_controller.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-03-10 03:54:40 +0000
committerFrancis Irving <francis@mysociety.org>2010-03-10 03:54:40 +0000
commit5ec31603058d5c4108d08ed5cfa62707aaeced7d (patch)
treec1c06794a338cfe3e30bc50f6c1364f1b0e1ab0a /app/controllers/user_controller.rb
parent96ff1f26d610393b0e6cfc177d98039820fcf0da (diff)
Use bob instead of silly as test user. Make it behave better if existing
email changed to.
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r--app/controllers/user_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index ec0afc214..80163db1d 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -246,11 +246,16 @@ class UserController < ApplicationController
@signchangeemail.logged_in_user = @user
if @signchangeemail.valid?
+ user_alreadyexists = User.find_user_by_email(@signchangeemail.new_email)
+ if user_alreadyexists
+ already_registered_mail user_alreadyexists
+ return
+ end
+
@user.email = @signchangeemail.new_email
@user.email_confirmed = false
@user.save!
self._do_signout
- flash[:notice] = "Your email has been changed."
send_confirmation_mail @user
return
end