]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/client_application.rb
Replace conditional comments with browser detection
[rails.git] / app / models / client_application.rb
index 67b86417a3a6a069a23d45e5e059c7b4aa415b87..d11942beb6434e7c393db40ad3cfd5f3c3c4849b 100644 (file)
@@ -51,12 +51,13 @@ class ClientApplication < ActiveRecord::Base
 
   def self.find_token(token_key)
     token = OauthToken.includes(:client_application).find_by(:token => token_key)
 
   def self.find_token(token_key)
     token = OauthToken.includes(:client_application).find_by(:token => token_key)
-    token if token && token.authorized?
+    token if token&.authorized?
   end
 
   def self.verify_request(request, options = {}, &block)
     signature = OAuth::Signature.build(request, options, &block)
     return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)
   end
 
   def self.verify_request(request, options = {}, &block)
     signature = OAuth::Signature.build(request, options, &block)
     return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)
+
     value = signature.verify
     value
   rescue OAuth::Signature::UnknownSignatureMethod
     value = signature.verify
     value
   rescue OAuth::Signature::UnknownSignatureMethod
@@ -68,11 +69,11 @@ class ClientApplication < ActiveRecord::Base
   end
 
   def oauth_server
   end
 
   def oauth_server
-    @oauth_server ||= OAuth::Server.new("http://" + SERVER_URL)
+    @oauth_server ||= OAuth::Server.new("https://" + SERVER_URL)
   end
 
   def credentials
   end
 
   def credentials
-    @oauth_client ||= OAuth::Consumer.new(key, secret)
+    @credentials ||= OAuth::Consumer.new(key, secret)
   end
 
   def create_request_token(_params = {})
   end
 
   def create_request_token(_params = {})