Reject supporter codes if they're already used by another email

This commit is contained in:
Matt Barringer 2013-02-06 07:23:35 +01:00
parent 152e8a345d
commit d6bda2f6dc
4 changed files with 47 additions and 5 deletions

View file

@ -24,11 +24,19 @@ class RegistrationsController < Devise::RegistrationsController
if email_changed or password_changed
successfully_updated = @user.update_with_password(params[:user])
else
params[:user].delete :current_password
successfully_updated = @user.update_without_password(params[:user])
end
if successfully_updated
set_flash_message :notice, :updated
if email_changed
if !@user.person.nil?
@user.person.update_attribute("email", params[:user][:email])
end
set_flash_message :notice, :update_needs_confirmation
else
set_flash_message :notice, :updated
end
# Sign in the user bypassing validation in case his password changed
sign_in @user, :bypass => true
redirect_to after_update_path_for(@user)