@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)
+ flash[:piwik_goal] = PIWIK["goals"]["signup"] if defined?(PIWIK)
+
+ referer = welcome_path
+
+ begin
+ uri = URI(session[:referer])
+ /map=(.*)\/(.*)\/(.*)/.match(uri.fragment) do |m|
+ editor = Rack::Utils.parse_query(uri.query).slice('editor')
+ referer = welcome_path({'zoom' => m[1],
+ 'lat' => m[2],
+ 'lon' => m[3]}.merge(editor))
+ end
+ rescue
+ # Use default
+ end
if @user.status == "active"
- session[:referer] = welcome_path
+ session[:referer] = referer
successful_login(@user)
else
session[:token] = @user.tokens.create.token
- Notifier.signup_confirm(@user, @user.tokens.create(:referer => welcome_path)).deliver
+ Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver
redirect_to :action => 'confirm', :display_name => @user.display_name
end
else
end
def confirm
- if request.post? && (token = UserToken.find_by_token(params[:confirm_string]))
- if token.user.active?
+ if request.post?
+ token = UserToken.find_by_token(params[:confirm_string])
+ if token && token.user.active?
flash[:error] = t('user.confirm.already active')
redirect_to :action => 'login'
+ elsif !token || token.expired?
+ flash[:error] = t('user.confirm.unknown token')
+ redirect_to :action => 'confirm'
else
user = token.user
user.status = "active"