diff --git a/source/developers/cla_sign.html b/source/developers/cla_sign.html
index 38e98f55b18..e6b7b2b9a9d 100644
--- a/source/developers/cla_sign.html
+++ b/source/developers/cla_sign.html
@@ -418,15 +418,21 @@ footer: true
});
}
+ function qs(key) {
+ key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
+ var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
+ return match && decodeURIComponent(match[1].replace(/\+/g, " "));
+ }
+
$(document).ready(function(){
populateCountries("country", "region");
var spinner = new Spinner().spin(document.getElementById('spinner'));
- var codeCheck = window.location.href.match(/\?code=(.*)/);
+ var codeCheck = qs('code');
if (codeCheck && codeCheck.length > 0) {
$.ajax({
type: "POST",
url: "https://cla.home-assistant.io/github/exchange",
- data: JSON.stringify({"code": codeCheck[1]}),
+ data: JSON.stringify({"code": codeCheck}),
contentType: "application/json",
}).done(function(data){
var uri = window.location.toString();