From 9375b397fa1ab6f4c5ded24c84c774e3d67a60e5 Mon Sep 17 00:00:00 2001 From: Mendhak Date: Sat, 23 Apr 2011 10:29:49 +0100 Subject: [PATCH 1/1] Allow any valid (per RFC 3986) scheme name in OAuth callback URLs Changed the callback_url regex so that you can have custom schemes such as myapp: or my-lovely-app: instead of just http and https. This should help with mobile development where users can authorize with OSM in their browser and are automatically redirected to the registered app. --- app/models/client_application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/client_application.rb b/app/models/client_application.rb index 09eec40d3..63c46a46f 100644 --- a/app/models/client_application.rb +++ b/app/models/client_application.rb @@ -9,7 +9,7 @@ class ClientApplication < ActiveRecord::Base 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, :allow_blank=>true - validates_format_of :callback_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true + validates_format_of :callback_url, :with => /\A([a-z]){1}([\w0-9\.\+\-])*:\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true attr_accessor :token_callback_url -- 2.43.2