X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7b89dc63496de0b6131a93c57d283ebb4490804b..a402e811dac1f999dcf623ce6099e554d76c6de4:/app/models/oauth2_verifier.rb?ds=inline diff --git a/app/models/oauth2_verifier.rb b/app/models/oauth2_verifier.rb index 94856d0d8..a404d0c7a 100644 --- a/app/models/oauth2_verifier.rb +++ b/app/models/oauth2_verifier.rb @@ -1,10 +1,11 @@ class Oauth2Verifier < OauthToken - validates_presence_of :user + validates :user, :presence => true, :associated => true + attr_accessor :state - def exchange!(params={}) + def exchange!(_params = {}) OauthToken.transaction do - token = Oauth2Token.create! :user=>user,:client_application=>client_application, :scope => scope + token = Oauth2Token.create! :user => user, :client_application => client_application, :scope => scope invalidate! token end @@ -27,7 +28,7 @@ class Oauth2Verifier < OauthToken protected def generate_keys - self.token = OAuth::Helper.generate_key(20)[0,20] + self.token = OAuth::Helper.generate_key(20)[0, 20] self.expires_at = 10.minutes.from_now self.authorized_at = Time.now end