X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/52e5fa6ad78f375cec5a207a123a4aa3939c8ddf..91d22710ba4b64d8c15f33f694a7a9206556b825:/app/models/oauth2_verifier.rb 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