Module: Panmind::Zendesk::Controller
- Defined in:
- lib/panmind/zendesk.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
95 96 97 |
# File 'lib/panmind/zendesk.rb', line 95 def self.included(base) base.before_filter :zendesk_handle_guests, :only => :zendesk_login end |
Instance Method Details
#zendesk_login ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/panmind/zendesk.rb', line 99 def zendesk_login name, email = instance_exec(&Zendesk.login) now = params[:timestamp] || Time.now.to_i.to_s hash = remote_hash({:name => name, :email => email, :token => Zendesk.token, :timestamp => now}) back = params[:return_to] || Zendesk.return_url auth_params = [ '?name=' + CGI.escape(name), '&email=' + CGI.escape(email), '×tamp=' + now, '&hash=' + hash, '&return_to=' + back ].join redirect_to(Zendesk.auth_url + auth_params) end |
#zendesk_logout ⇒ Object
117 118 119 120 |
# File 'lib/panmind/zendesk.rb', line 117 def zendesk_logout flash[:notice] = "Thanks for visiting our support forum." redirect_to root_url end |