31 lines
795 B
Ruby
31 lines
795 B
Ruby
|
class UsersController < ApplicationController
|
||
|
# Be sure to include AuthenticationSystem in Application Controller instead
|
||
|
include AuthenticatedSystem
|
||
|
|
||
|
# render new.rhtml
|
||
|
def new
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
cookies.delete :auth_token
|
||
|
reset_session
|
||
|
@user = User.new(params[:user])
|
||
|
@user.save!
|
||
|
self.current_user = @user
|
||
|
redirect_back_or_default('/')
|
||
|
flash[:notice] = "Thanks for signing up!"
|
||
|
rescue ActiveRecord::RecordInvalid
|
||
|
render :action => 'new'
|
||
|
end
|
||
|
|
||
|
def activate
|
||
|
self.current_user = params[:activation_code].blank? ? :false : User.find_by_activation_code(params[:activation_code])
|
||
|
if logged_in? && !current_user.activated?
|
||
|
current_user.activate
|
||
|
flash[:notice] = "Signup complete!"
|
||
|
end
|
||
|
redirect_back_or_default('/')
|
||
|
end
|
||
|
|
||
|
end
|