driftrock-service 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module Driftrock::Service
|
|
2
2
|
module DriftrockApp
|
3
3
|
|
4
4
|
def authorise
|
5
|
-
return
|
5
|
+
return unless should_authorise
|
6
6
|
timestamp = params[:timestamp]
|
7
7
|
company_id= params[:company_id]
|
8
8
|
token = params[:token]
|
@@ -15,7 +15,15 @@ module Driftrock::Service
|
|
15
15
|
session[:company_id] = params[:company_id]
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
def should_authorise?
|
20
|
+
has_auth_params = params[:timestamp] && params[:company_id] && params[:token]
|
21
|
+
has_session_data = defined?(session) && session[:user_id] &&
|
22
|
+
session[:company_id]
|
18
23
|
|
24
|
+
has_auth_params || !has_session_data
|
25
|
+
end
|
26
|
+
|
19
27
|
def driftrock_app_status
|
20
28
|
render text: "OK"
|
21
29
|
end
|