class UserController < ApplicationController
- layout 'site'
+ layout 'site', :except => :api_details
before_filter :authorize, :only => [:api_details, :api_gpx_files]
before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
before_filter :check_database_readable, :except => [:api_details, :api_gpx_files]
before_filter :check_database_writable, :only => [:login, :new, :set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image]
before_filter :check_api_readable, :only => [:api_details, :api_gpx_files]
+ before_filter :require_allow_read_prefs, :only => [:api_details]
+ before_filter :require_allow_read_gpx, :only => [:api_gpx_files]
filter_parameter_logging :password, :pass_crypt, :pass_crypt_confirmation
if @user.save
flash[:notice] = t 'user.new.flash create success message'
- Notifier.deliver_signup_confirm(@user, @user.tokens.create)
+ Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => params[:referer]))
redirect_to :action => 'login'
else
render :action => 'new'
def account
@title = t 'user.account.title'
+ @tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
if params[:user] and params[:user][:display_name] and params[:user][:description]
if params[:user][:email] != @user.email
@user.active = true
@user.email_valid = true
@user.save!
+ referer = token.referer
token.destroy
flash[:notice] = t 'user.confirm.success'
session[:user] = @user.id
- redirect_to :action => 'account', :display_name => @user.display_name
+ unless referer.nil?
+ redirect_to referer
+ else
+ redirect_to :action => 'account', :display_name => @user.display_name
+ end
else
@notice = t 'user.confirm.failure'
end
redirect_to :controller => 'user', :action => 'view', :display_name => @user.display_name
end
- def api_details
- render :text => @user.to_xml.to_s, :content_type => "text/xml"
- end
-
def api_gpx_files
doc = OSM::API.new.get_xml_doc
@user.traces.each do |trace|