diff options
author | Lauris BH <lauris@nix.lv> | 2018-11-09 00:46:44 +0200 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-11-08 17:46:44 -0500 |
commit | de8f98192b113fde31c6361584b624c48de83895 (patch) | |
tree | d2a43f76830a8c508aabdff7745a74b94d07dd1f /public/js | |
parent | c2f72b13460e0db5e90a61c57c8f57fcb8c5527f (diff) | |
download | gitea-de8f98192b113fde31c6361584b624c48de83895.tar.gz gitea-de8f98192b113fde31c6361584b624c48de83895.zip |
Fix U2F if gitea is configured in subpath (#5302)
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/index.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/public/js/index.js b/public/js/index.js index f5d3ef2d93..c6531cb225 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1530,7 +1530,7 @@ function initU2FAuth() { } u2fApi.ensureSupport() .then(function () { - $.getJSON('/user/u2f/challenge').success(function(req) { + $.getJSON(suburl + '/user/u2f/challenge').success(function(req) { u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30) .then(u2fSigned) .catch(function (err) { @@ -1543,16 +1543,16 @@ function initU2FAuth() { }); }).catch(function () { // Fallback in case browser do not support U2F - window.location.href = "/user/two_factor" + window.location.href = suburl + "/user/two_factor" }) } function u2fSigned(resp) { $.ajax({ - url:'/user/u2f/sign', - type:"POST", + url: suburl + '/user/u2f/sign', + type: "POST", headers: {"X-Csrf-Token": csrf}, data: JSON.stringify(resp), - contentType:"application/json; charset=utf-8", + contentType: "application/json; charset=utf-8", }).done(function(res){ window.location.replace(res); }).fail(function (xhr, textStatus) { @@ -1565,11 +1565,11 @@ function u2fRegistered(resp) { return; } $.ajax({ - url:'/user/settings/security/u2f/register', - type:"POST", + url: suburl + '/user/settings/security/u2f/register', + type: "POST", headers: {"X-Csrf-Token": csrf}, data: JSON.stringify(resp), - contentType:"application/json; charset=utf-8", + contentType: "application/json; charset=utf-8", success: function(){ window.location.reload(); }, @@ -1623,7 +1623,7 @@ function initU2FRegister() { } function u2fRegisterRequest() { - $.post("/user/settings/security/u2f/request_register", { + $.post(suburl + "/user/settings/security/u2f/request_register", { "_csrf": csrf, "name": $('#nickname').val() }).success(function(req) { |