diff --git a/src/UI/Settings/UITabSecurity.js b/src/UI/Settings/UITabSecurity.js index 65ccf5b4..7514b9ce 100644 --- a/src/UI/Settings/UITabSecurity.js +++ b/src/UI/Settings/UITabSecurity.js @@ -8,6 +8,7 @@ export default { icon: 'shield.svg', html: () => { let h = `

${i18n('security')}

`; + let user = window.user; // change password button if(!user.is_temp){ @@ -84,7 +85,7 @@ export default { ] }) if ( ! alert_resp ) return; - const resp = await fetch(`${api_origin}/auth/configure-2fa/disable`, { + const resp = await fetch(`${window.api_origin}/auth/configure-2fa/disable`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`, diff --git a/src/UI/UIWindow2FASetup.js b/src/UI/UIWindow2FASetup.js index b76fafd9..d574f8d3 100644 --- a/src/UI/UIWindow2FASetup.js +++ b/src/UI/UIWindow2FASetup.js @@ -36,7 +36,7 @@ import UIComponentWindow from "./UIComponentWindow.js"; const UIWindow2FASetup = async function UIWindow2FASetup () { // FIRST REQUEST :: Generate the QR code and recovery codes - const resp = await fetch(`${api_origin}/auth/configure-2fa/setup`, { + const resp = await fetch(`${window.api_origin}/auth/configure-2fa/setup`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`, @@ -48,7 +48,7 @@ const UIWindow2FASetup = async function UIWindow2FASetup () { // SECOND REQUEST :: Verify the code [first wizard screen] const check_code_ = async function check_code_ (value) { - const resp = await fetch(`${api_origin}/auth/configure-2fa/test`, { + const resp = await fetch(`${window.api_origin}/auth/configure-2fa/test`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`, @@ -66,7 +66,7 @@ const UIWindow2FASetup = async function UIWindow2FASetup () { // FINAL REQUEST :: Enable 2FA [second wizard screen] const enable_2fa_ = async function check_code_ (value) { - const resp = await fetch(`${api_origin}/auth/configure-2fa/enable`, { + const resp = await fetch(`${window.api_origin}/auth/configure-2fa/enable`, { method: 'POST', headers: { Authorization: `Bearer ${puter.authToken}`, diff --git a/src/UI/UIWindowLogin.js b/src/UI/UIWindowLogin.js index 6c1ca26c..0885577a 100644 --- a/src/UI/UIWindowLogin.js +++ b/src/UI/UIWindowLogin.js @@ -199,7 +199,7 @@ async function UIWindowLogin(options){ let error_i18n_key = 'something_went_wrong'; if ( ! value ) return; try { - const resp = await fetch(`${api_origin}/login/otp`, { + const resp = await fetch(`${window.api_origin}/login/otp`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -268,7 +268,7 @@ async function UIWindowLogin(options){ let error_i18n_key = 'something_went_wrong'; if ( ! value ) return; try { - const resp = await fetch(`${api_origin}/login/recovery-code`, { + const resp = await fetch(`${window.api_origin}/login/recovery-code`, { method: 'POST', headers: { 'Content-Type': 'application/json',