Class: Devise::CheckgaController

Inherits:
SessionsController
  • Object
show all
Includes:
Devise::Controllers::Helpers
Defined in:
app/controllers/devise/checkga_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
# File 'app/controllers/devise/checkga_controller.rb', line 7

def show
  @tmpid = params[:id]
  if @tmpid.nil?
    redirect_to :root
  else
    render :show
  end
end

#updateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/devise/checkga_controller.rb', line 16

def update
  resource = resource_class.find_by_gauth_tmp(params[resource_name]['tmpid'])

  if not resource.nil?

    if resource.validate_token(params[resource_name]['gauth_token'].to_i)
      set_flash_message(:notice, :signed_in) if is_navigational_format?
      (resource_name,resource)
      warden.manager._run_callbacks(:after_set_user, resource, warden, {:event => :authentication})
      respond_with resource, :location => (resource)

      if not resource.class.ga_remembertime.nil? 
        cookies.signed[:gauth] = {
          :value => resource.email << "," << Time.now.to_i.to_s,
          :secure => !(Rails.env.test? || Rails.env.development?),
          :expires => (resource.class.ga_remembertime + 1.days).from_now
        }
      end
    else
      set_flash_message(:error, :error)
      redirect_to :root
    end

  else
    set_flash_message(:error, :error)
    redirect_to :root
  end
end