Module: MerbAuth::Controller::UsersBase::InstanceMethods

Defined in:
lib/merb-auth/controller/users_base.rb

Instance Method Summary collapse

Instance Method Details

#activateObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/merb-auth/controller/users_base.rb', line 38

def activate
  self.current_ma_user = MA[:user].find_with_conditions(:activation_code => params[:activation_code])
  if logged_in? && !current_ma_user.activated?
    Merb.logger.info "Activated #{current_ma_user}"
    current_ma_user.activate
    redirect url(:merb_auth_activated)
  else
    redirect url(:merb_auth_activated, :fail => 'true')
  end
end

#createObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/merb-auth/controller/users_base.rb', line 22

def create
  cookies.delete :auth_token
  @use_recaptcha = Object.const_defined?(:Ambethia)

  @ivar = MA[:user].new(params[MA[:single_resource]])
  set_ivar
  #if (!@use_recaptcha || verify_recaptcha(@ivar, :failure_message => nil)) && @ivar.save
  if (!@use_recaptcha || verify_recaptcha(@ivar, :failure_message => nil)) && @ivar.valid?
    @ivar.save
    self.current_ma_user = @ivar unless MA[:use_activation]
    redirect url(:merb_auth_registered)
  else
    render :new
  end
end

#newObject

Displays the new form for the user



15
16
17
18
19
20
# File 'lib/merb-auth/controller/users_base.rb', line 15

def new
  only_provides :html
  @ivar = MA[:user].new(params[MA[:single_resource]] || {})
  set_ivar
  display @ivar
end