Resolve eslint issues in new 2FA code

/puter/src/UI/Settings/UITabSecurity.js
  13:13  error  'user' is not defined        no-undef
  31:13  error  'user' is not defined        no-undef
  32:70  error  'user' is not defined        no-undef
  36:30  error  'user' is not defined        no-undef
  40:82  error  'user' is not defined        no-undef
  41:83  error  'user' is not defined        no-undef
  87:41  error  'api_origin' is not defined  no-undef

/puter/src/UI/UIWindow2FASetup.js
  39:33  error  'api_origin' is not defined  no-undef
  51:37  error  'api_origin' is not defined  no-undef
  69:37  error  'api_origin' is not defined  no-undef

/puter/src/UI/UIWindowLogin.js
  202:73  error  'api_origin' is not defined  no-undef
  271:73  error  'api_origin' is not defined  no-undef
This commit is contained in:
Sam Atkins
2024-05-08 09:49:58 +01:00
parent 6778aa4343
commit 2604dae83c
3 changed files with 7 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ export default {
icon: 'shield.svg',
html: () => {
let h = `<h1>${i18n('security')}</h1>`;
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}`,

View File

@@ -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}`,

View File

@@ -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',