- if @user.valid?
- if params[:user][:openid_url].nil? or
- params[:user][:openid_url].empty?
- # No OpenID so just move on to the terms
- render :action => 'terms'
- else
+ if @user
+ if @user.invalid?
+ if @user.new_record?
+ # Something is wrong with a new user, so rerender the form
+ render :action => :new
+ else
+ # Error in existing user, so go to account settings
+ flash[:errors] = @user.errors
+ redirect_to :action => :account, :display_name => @user.display_name
+ end
+ elsif @user.terms_agreed?
+ # Already agreed to terms, so just show settings
+ redirect_to :action => :account, :display_name => @user.display_name
+ elsif params[:user] and params[:user][:openid_url]