26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/zendesk_remote_authentication.rb', line 26
def zendesk_remote_authentication_url(params)
raise ArgumentError.new("You must provide name and email address") unless (params[:name] && params[:email])
token = Zendesk::RemoteAuthentication.token
timestamp = params[:timestamp] || Time.now.to_i.to_s
name = params[:name]
email = params[:email]
external_id = params[:external_id]
hash = Digest::MD5.hexdigest(name + email + external_id + token + timestamp)
back = params[:return_to]
auth_params = [
'?name=' + CGI.escape(name),
'&email=' + CGI.escape(email),
'×tamp=' + now,
'&hash=' + hash,
'&return_to=' + back
].join
Zendesk::RemoteAuthentication.auth_url + auth_params
end
|