From bfdc5dbdcbcc48bffe623d893bc5b3cdeebe7b64 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Thu, 12 Apr 2012 09:50:43 -0600
Subject: [PATCH] on browserid.org, set origin in user.js to a proper origin. 
 This was breaking code that expected it to be an origin, like /signup which
 invokes the stage_user api, which now validates the 'site' parameter is a
 properly formed origin.  issue #1429

Conflicts:

	resources/static/shared/user.js
---
 resources/static/shared/user.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/resources/static/shared/user.js b/resources/static/shared/user.js
index a34524c7a..dd3e182e8 100644
--- a/resources/static/shared/user.js
+++ b/resources/static/shared/user.js
@@ -1163,6 +1163,15 @@ BrowserID.User = (function() {
     }
   };
 
-  User.setOrigin(document.location.host);
+  // Set origin to default to the current domain.  Other contexts that use user.js,
+  // like dialogs or iframes, will call setOrigin themselves to update this to
+  // the origin of the of the RP.  On browserid.org, it will remain the origin of
+  // browserid.org
+  var currentOrigin = window.location.protocol + '//' + window.location.hostname;
+  if (window.location.port) {
+    currentOrigin += ':' + window.location.port;
+  }
+  User.setOrigin(currentOrigin);
+
   return User;
 }());
-- 
GitLab