29 lines
764 B
Ruby
29 lines
764 B
Ruby
|
class UtilisateursController < ApplicationController
|
||
|
|
||
|
# render new.rhtml
|
||
|
def new
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
cookies.delete :auth_token
|
||
|
reset_session
|
||
|
@utilisateur = Utilisateur.new(params[:utilisateur])
|
||
|
@utilisateur.save!
|
||
|
self.current_utilisateur = @utilisateur
|
||
|
redirect_back_or_default('/')
|
||
|
flash[:notice] = "Thanks for signing up!"
|
||
|
rescue ActiveRecord::RecordInvalid
|
||
|
render :action => 'new'
|
||
|
end
|
||
|
|
||
|
def activate
|
||
|
self.current_utilisateur = params[:activation_code].blank? ? :false : Utilisateur.find_by_activation_code(params[:activation_code])
|
||
|
if logged_in? && !current_utilisateur.activated?
|
||
|
current_utilisateur.activate
|
||
|
flash[:notice] = "Signup complete!"
|
||
|
end
|
||
|
redirect_back_or_default('/')
|
||
|
end
|
||
|
|
||
|
end
|