Module: Zendesk::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/zendesk/controller.rb

Instance Method Summary collapse

Instance Method Details

#zendesk_loginObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/zendesk/controller.rb', line 12

def 
  name, email = instance_exec(&Zendesk.)

  now  = params[:timestamp] || Time.now.to_i.to_s
  hash = Digest::MD5.hexdigest(name + email + Zendesk.token + now)
  back = params[:return_to] || Zendesk.return_url

  auth_params = [
    '?name='      + CGI.escape(name),
    '&email='     + CGI.escape(email),
    '&timestamp=' + now,
    '&hash='      + hash,
    '&return_to=' + back
  ].join

  redirect_to(Zendesk.auth_url + auth_params)
end

#zendesk_logoutObject



30
31
32
33
# File 'lib/zendesk/controller.rb', line 30

def zendesk_logout
  flash[:notice] = "Thanks for visiting our support forum."
  redirect_to root_url
end