Handle attempts to agree terms by users with validation errors better
This commit is contained in:
parent
7b3e8871d5
commit
2f0ed54206
1 changed files with 7 additions and 2 deletions
|
@ -32,7 +32,12 @@ class UserController < ApplicationController
|
|||
|
||||
if @user
|
||||
if @user.invalid?
|
||||
render :action => :new
|
||||
if @user.new_record?
|
||||
render :action => :new
|
||||
else
|
||||
flash[:errors] = @user.errors
|
||||
redirect_to :action => :account, :display_name => @user.display_name
|
||||
end
|
||||
elsif @user.terms_agreed?
|
||||
redirect_to :action => :account, :display_name => @user.display_name
|
||||
end
|
||||
|
@ -123,7 +128,7 @@ class UserController < ApplicationController
|
|||
else
|
||||
if flash[:errors]
|
||||
flash[:errors].each do |attr,msg|
|
||||
attr = "new_email" if attr == "email"
|
||||
attr = "new_email" if attr == "email" and !@user.new_email.nil?
|
||||
@user.errors.add(attr,msg)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue