diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-10-21 15:37:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 15:37:43 +0800 |
commit | 2add8fe9beede4aa82c913fcb70c0cf5bb1c6185 (patch) | |
tree | be2555d0a8f0ae926d56eefd3a3b3e533985074a /web_src/js/features/user-auth-u2f.js | |
parent | 5879ab83b5fab57a71aed4c8b3c4d9293b4a4398 (diff) | |
download | gitea-2add8fe9beede4aa82c913fcb70c0cf5bb1c6185.tar.gz gitea-2add8fe9beede4aa82c913fcb70c0cf5bb1c6185.zip |
Frontend refactor, PascalCase to camelCase, remove unused code (#17365)
* Frontend refactor, PascalCase to camelCase, remove unused code
* fix
Diffstat (limited to 'web_src/js/features/user-auth-u2f.js')
-rw-r--r-- | web_src/js/features/user-auth-u2f.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/web_src/js/features/user-auth-u2f.js b/web_src/js/features/user-auth-u2f.js index 25255213a8..15beaaa207 100644 --- a/web_src/js/features/user-auth-u2f.js +++ b/web_src/js/features/user-auth-u2f.js @@ -1,11 +1,11 @@ -const {AppSubUrl, csrf} = window.config; +const {appSubUrl, csrfToken} = window.config; export function initUserAuthU2fAuth() { if ($('#wait-for-key').length === 0) { return; } u2fApi.ensureSupport().then(() => { - $.getJSON(`${AppSubUrl}/user/u2f/challenge`).done((req) => { + $.getJSON(`${appSubUrl}/user/u2f/challenge`).done((req) => { u2fApi.sign(req.appId, req.challenge, req.registeredKeys, 30) .then(u2fSigned) .catch((err) => { @@ -18,15 +18,15 @@ export function initUserAuthU2fAuth() { }); }).catch(() => { // Fallback in case browser do not support U2F - window.location.href = `${AppSubUrl}/user/two_factor`; + window.location.href = `${appSubUrl}/user/two_factor`; }); } function u2fSigned(resp) { $.ajax({ - url: `${AppSubUrl}/user/u2f/sign`, + url: `${appSubUrl}/user/u2f/sign`, type: 'POST', - headers: {'X-Csrf-Token': csrf}, + headers: {'X-Csrf-Token': csrfToken}, data: JSON.stringify(resp), contentType: 'application/json; charset=utf-8', }).done((res) => { @@ -41,9 +41,9 @@ function u2fRegistered(resp) { return; } $.ajax({ - url: `${AppSubUrl}/user/settings/security/u2f/register`, + url: `${appSubUrl}/user/settings/security/u2f/register`, type: 'POST', - headers: {'X-Csrf-Token': csrf}, + headers: {'X-Csrf-Token': csrfToken}, data: JSON.stringify(resp), contentType: 'application/json; charset=utf-8', success() { @@ -99,8 +99,8 @@ export function initUserAuthU2fRegister() { } function u2fRegisterRequest() { - $.post(`${AppSubUrl}/user/settings/security/u2f/request_register`, { - _csrf: csrf, + $.post(`${appSubUrl}/user/settings/security/u2f/request_register`, { + _csrf: csrfToken, name: $('#nickname').val() }).done((req) => { $('#nickname').closest('div.field').removeClass('error'); |