1
# I usually use the user class from restful_authentication as my principle voter class
2
# There are generally no changes required to support voting in this controller.
4
class UsersController < ApplicationController
5
# Be sure to include AuthenticationSystem in Application Controller instead
6
include AuthenticatedSystem
8
# Protect these actions behind an admin login
9
before_filter :admin_required, :only => [:suspend, :unsuspend, :destroy, :purge]
10
before_filter :find_user, :only => [:suspend, :unsuspend, :destroy, :purge, :show]
12
before_filter :login_required, :only => [:index]
24
cookies.delete :auth_token
25
@user = User.new(params[:user])
26
@user.register! if @user.valid?
27
if @user.errors.empty?
28
self.current_user.forget_me if logged_in?
29
cookies.delete :auth_token
31
flash[:notice] = "Thanks for signing up!"
33
render :action => 'new'
38
unless params[:activation_code].blank?
39
self.current_user = User.find_by_activation_code(params[:activation_code])
40
if logged_in? && !current_user.active?
41
current_user.activate!
42
flash[:notice] = "Signup complete!"
43
redirect_back_or_default('/')
45
flash[:error] = "Sorry, we couldn't find that activation code. Please cut and paste your activation code into the space at left."
48
# render activate.html.erb
53
redirect_to users_path
58
redirect_to users_path
63
redirect_to users_path
68
redirect_to users_path
73
@user = User.find(params[:id])