Browse files

Updated client_application to handle oob callback_url case.

  • Loading branch information...
1 parent a1252a8 commit 120d11e5576ff2aa770efa674f5fe5d333eccad5 @pelle committed Jul 13, 2009
Showing with 6 additions and 3 deletions.
  1. +1 −1 MIT-LICENSE
  2. +5 −2 generators/oauth_provider/templates/client_application.rb
View
2 MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2007 [name of plugin creator]
+Copyright (c) 2007 Pelle Braendgaard
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
7 generators/oauth_provider/templates/client_application.rb
@@ -7,8 +7,9 @@ class ClientApplication < ActiveRecord::Base
before_validation_on_create :generate_keys
validates_format_of :url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i
- validates_format_of :support_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i
- validates_format_of :callback_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i
+ validates_format_of :support_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true
+ validates_format_of :callback_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true
+
attr_accessor :token_callback_url
def self.find_token(token_key)
@@ -41,6 +42,8 @@ def credentials
end
def create_request_token
+ # we can't use oob so we convert it to nil. OOB will have been setup before hand.
+ token_callback_url=nil if token_callback_url=='oob'
RequestToken.create :client_application => self,:callback_url=>token_callback_url
end

0 comments on commit 120d11e

Please sign in to comment.