+ @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
+ @user.terms_seen = true
+ @user.openid_url = nil if @user.openid_url and @user.openid_url.empty?
+
+ if @user.save
+ flash[:piwik_goal] = PIWIK_SIGNUP_GOAL if defined?(PIWIK_SIGNUP_GOAL)
+
+ if @user.status == "active"
+ flash[:notice] = t 'user.new.flash welcome', :email => @user.email
+ session[:referer] = welcome_path
+
+ successful_login(@user)
+ else
+ flash[:notice] = t 'user.new.flash create success message', :email => @user.email
+ session[:token] = @user.tokens.create.token
+
+ Notifier.signup_confirm(@user, @user.tokens.create(:referer => welcome_path)).deliver
+
+ redirect_to :action => 'login', :referer => params[:referer]
+ end
+ else
+ render :action => 'new', :referer => params[:referer]
+ end