- # Render the signup page unless we have already been
- # redirected or have managed to save the user
- if response.location.nil? and @user.new_record?
- render :action => "new"
+ if @user.openid_url.nil? or @user.invalid?
+ render :action => 'new'
+ else
+ render :action => 'terms'
+ end
+ end
+ end
+
+ def save
+ @title = t 'user.new.title'
+
+ if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"})
+ render :action => 'new'
+ elsif params[:decline]
+ redirect_to t('user.terms.declined')
+ else
+ @user = User.new(params[:user])
+
+ @user.status = "pending"
+ @user.data_public = true
+ @user.description = "" if @user.description.nil?
+ @user.creation_ip = request.remote_ip
+ @user.languages = request.user_preferred_languages
+ @user.terms_agreed = Time.now.getutc
+
+ if @user.save
+ flash[:notice] = t 'user.new.flash create success message'
+ Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer)))
+ redirect_to :action => 'login'
+ else
+ render :action => 'new'