before_filter :authorize, :only => [:api_details, :api_gpx_files]
before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
before_filter :authorize, :only => [:api_details, :api_gpx_files]
before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
before_filter :require_user, :only => [:set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image]
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 :require_user, :only => [:set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image]
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]
Notifier.deliver_signup_confirm(@user, @user.tokens.create)
redirect_to :action => 'login'
else
Notifier.deliver_signup_confirm(@user, @user.tokens.create)
redirect_to :action => 'login'
else
if params[:user] and params[:user][:display_name] and params[:user][:description]
if params[:user][:email] != @user.email
@user.new_email = params[:user][:email]
if params[:user] and params[:user][:display_name] and params[:user][:description]
if params[:user][:email] != @user.email
@user.new_email = params[:user][:email]
if user
token = user.tokens.create
Notifier.deliver_lost_password(user, token)
if user
token = user.tokens.create
Notifier.deliver_lost_password(user, token)
- pass = OSM::make_token(8)
- user = token.user
- user.pass_crypt = pass
- user.pass_crypt_confirmation = pass
- user.active = true
- user.email_valid = true
- user.save!
- token.destroy
- Notifier.deliver_reset_password(user, pass)
- flash[:notice] = "Your password has been changed and is on its way to your mailbox :-)"
+ @user = token.user
+
+ if params[:user]
+ @user.pass_crypt = params[:user][:pass_crypt]
+ @user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
+ @user.active = true
+ @user.email_valid = true
+
+ if @user.save
+ token.destroy
+ flash[:notice] = t 'user.reset_password.flash changed'
+ redirect_to :action => 'login'
+ end
+ end
- @title = 'create account'
+ @title = t 'user.new.title'
+
+ # The user is logged in already, so don't show them the signup page, instead
+ # send them to the home page
+ redirect_to :controller => 'site', :action => 'index' if session[:user]
+ if session[:user]
+ # The user is logged in already, if the referer param exists, redirect them to that
+ if params[:referer]
+ redirect_to params[:referer]
+ else
+ redirect_to :controller => 'site', :action => 'index'
+ end
+ return
+ end
+
+ @title = t 'user.login.title'
+
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
@not_found_user = params[:display_name]
render :action => 'no_such_user', :status => :not_found
end
@not_found_user = params[:display_name]
render :action => 'no_such_user', :status => :not_found
end
friend = Friend.new
friend.user_id = @user.id
friend.friend_user_id = new_friend.id
unless @user.is_friends_with?(new_friend)
if friend.save
friend = Friend.new
friend.user_id = @user.id
friend.friend_user_id = new_friend.id
unless @user.is_friends_with?(new_friend)
if friend.save
if @user.is_friends_with?(friend)
Friend.delete_all "user_id = #{@user.id} AND friend_user_id = #{friend.id}"
if @user.is_friends_with?(friend)
Friend.delete_all "user_id = #{@user.id} AND friend_user_id = #{friend.id}"