before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
before_filter :set_locale, :except => [:api_details, :api_gpx_files]
before_filter :require_user, :only => [:account, :go_public, :make_friend, :remove_friend]
- before_filter :check_database_readable, :except => [:api_details, :api_gpx_files]
- before_filter :check_database_writable, :only => [:login, :new, :account, :go_public, :make_friend, :remove_friend]
+ before_filter :check_database_readable, :except => [:login, :api_details, :api_gpx_files]
+ before_filter :check_database_writable, :only => [:new, :account, :confirm, :confirm_email, :lost_password, :reset_password, :go_public, :make_friend, :remove_friend]
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]
else
render :action => 'terms'
end
+ elsif params[:user] and Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
+ render :action => 'blocked'
else
session[:referer] = params[:referer]
def save
@title = t 'user.new.title'
- if Acl.address(request.remote_ip).where(:k => "no_account_creation").exists?
- render :action => 'new'
- elsif params[:decline]
+ if params[:decline]
if @user
@user.terms_seen = true
else
redirect_to :action => :account, :display_name => @user.display_name
end
+ elsif Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
+ render :action => 'blocked'
else
@user = User.new(params[:user])
@user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
end
- @user.description = params[:user][:description]
+ if params[:user][:description] != @user.description
+ @user.description = params[:user][:description]
+ @user.description_format = "markdown"
+ end
+
@user.languages = params[:user][:languages].split(",")
case params[:image_action]
:openid_url => params[:openid])
flash.now[:notice] = t 'user.new.openid association'
+ elsif Acl.no_account_creation(request.remote_ip)
+ render :action => 'blocked'
end
end
(@this_user.visible? or (@user and @user.administrator?))
@title = @this_user.display_name
else
- @title = t 'user.no_such_user.title'
- @not_found_user = params[:display_name]
- render :action => 'no_such_user', :status => :not_found
+ render_unknown_user params[:display_name]
end
end
##
# sets a user's status
def set_status
- @this_user.update_attributes(:status => params[:status])
+ @this_user.status = params[:status]
+ @this_user.save
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]
end
cookies.permanent["_osm_username"] = user.display_name
session[:user] = user.id
- session_expires_after 1.month if session[:remember_me]
+ session_expires_after 28.days if session[:remember_me]
target = session[:referer] || url_for(:controller => :site, :action => :index)
if user.save
set_locale
+ cookies.permanent["_osm_username"] = user.display_name
+
if user.new_email.blank?
flash.now[:notice] = t 'user.account.flash update success'
else
# Choose the layout to use. See
# https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts
def choose_layout
- oauth_url = url_for(:controller => :oauth, :action => :oauthorize, :only_path => true)
+ oauth_url = url_for(:controller => :oauth, :action => :authorize, :only_path => true)
if [ 'api_details' ].include? action_name
nil