Class: AuthEng::ConfirmationsController

Inherits:
Devise::PasswordsController
  • Object
show all
Defined in:
app/controllers/auth_eng/confirmations_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

GET /resource/confirmation?confirmation_token=abcdef



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/auth_eng/confirmations_controller.rb', line 33

def show
  params[:confirmation_token] ||= params[:user][:confirmation_token]
  with_unconfirmed_confirmable do
    if @confirmable.has_no_password?
      do_show
    else
      do_confirm
    end
  end
  if !@confirmable.errors.empty?
    render 'auth_eng/confirmations/show' #Change this if you don't have the views on default path 
  end
end

#updateObject

PUT /resource/confirmation



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/auth_eng/confirmations_controller.rb', line 11

def update
  params[:confirmation_token] ||= params[:user][:confirmation_token]
  @confirmation_token = params[:user][:confirmation_token]
  with_unconfirmed_confirmable do
    if @confirmable.has_no_password?
      @confirmable.attempt_set_password(params[:user])
      if @confirmable.valid?
        do_confirm
      else
        do_show
        @confirmable.errors.clear #so that we wont render :new
      end
    else
      self.class.add_error_on(self, :email, :password_allready_set)
    end
  end
  if !@confirmable.errors.empty?
    do_show #Change this if you don't have the views on default path
  end
end