if session[:user]
@user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first
- if @user.status == "suspended"
+ if @user.display_name != cookies["_osm_username"]
+ reset_session
+ @user = nil
+ elsif @user.status == "suspended"
session.delete(:user)
session_expires_automatically
elsif session[:token]
if @user = User.authenticate(:token => session[:token])
session[:user] = @user.id
+ else
+ reset_session
end
end
rescue Exception => ex
logger.info("Exception authorizing user: #{ex.to_s}")
+ reset_session
@user = nil
end
token.destroy
session[:user] = user.id
+ cookies["_osm_username"] = user.display_name
if referer.nil?
flash[:notice] = t('user.confirm.success') + "<br /><br />" + t('user.confirm.before you start')
end
token.destroy
session[:user] = @user.id
+ cookies["_osm_username"] = @user.display_name
redirect_to :action => 'account', :display_name => @user.display_name
else
flash[:error] = t 'user.confirm_email.failure'
##
# process a successful login
def successful_login(user)
+ cookies["_osm_username"] = user.display_name
+
session[:user] = user.id
session_expires_after 1.month if session[:remember_me]