mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fix lint warnings
This commit is contained in:
parent
047f5b364f
commit
9c83347162
@ -81,10 +81,10 @@ console.log(state.mfaError);
|
|||||||
<div className="description">{state.strings.mfaEnter}</div>
|
<div className="description">{state.strings.mfaEnter}</div>
|
||||||
<Input.OTP onChange={actions.setCode} />
|
<Input.OTP onChange={actions.setCode} />
|
||||||
<div className="alert">
|
<div className="alert">
|
||||||
{ state.mfaError == 'Error: 403' && (
|
{ state.mfaError === '403' && (
|
||||||
<span>{state.strings.mfaError}</span>
|
<span>{state.strings.mfaError}</span>
|
||||||
)}
|
)}
|
||||||
{ state.mfaError == 'Error: 429' && (
|
{ state.mfaError === '429' && (
|
||||||
<span>{state.strings.mfaDisabled}</span>
|
<span>{state.strings.mfaDisabled}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,8 +52,9 @@ export function useLogin() {
|
|||||||
await app.actions.login(state.username, state.password, state.mfaCode)
|
await app.actions.login(state.username, state.password, state.mfaCode)
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
if (err == 'Error: 405' || err == 'Error: 403' || err == 'Error: 429') {
|
const msg = err?.message;
|
||||||
updateState({ busy: false, mfaModal: true, mfaError: err.toString() });
|
if (msg === '405' || msg === '403' || msg === '429') {
|
||||||
|
updateState({ busy: false, mfaModal: true, mfaError: msg });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { AccountAccessWrapper, LoginModal, MFAModal, SealModal, LogoutContent } from './AccountAccess.styled';
|
import { AccountAccessWrapper, LoginModal, MFAModal, SealModal, LogoutContent } from './AccountAccess.styled';
|
||||||
import { useAccountAccess } from './useAccountAccess.hook';
|
import { useAccountAccess } from './useAccountAccess.hook';
|
||||||
import { Button, Modal, Switch, Input, Radio, Select, Flex, Typography } from 'antd';
|
import { Button, Modal, Switch, Input, Radio, Select } from 'antd';
|
||||||
import type { GetProp } from 'antd';
|
import { LogoutOutlined, SettingOutlined, UserOutlined, LockOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||||
import type { OTPProps } from 'antd/es/input/OTP';
|
|
||||||
import { LogoutOutlined, SettingOutlined, UserOutlined, LockOutlined, ExclamationCircleOutlined, KeyOutlined } from '@ant-design/icons';
|
|
||||||
import { CopyButton } from '../../../../copyButton/CopyButton';
|
import { CopyButton } from '../../../../copyButton/CopyButton';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
|
||||||
@ -110,7 +108,7 @@ export function AccountAccess() {
|
|||||||
<div className="control">
|
<div className="control">
|
||||||
<Switch size="small" checked={state.mfaEnabled} onChange={enable => enableMFA(enable)} />
|
<Switch size="small" checked={state.mfaEnabled} onChange={enable => enableMFA(enable)} />
|
||||||
</div>
|
</div>
|
||||||
<div className="switchLabel">Multi-Factor Authentication</div>
|
<div className="switchLabel">{state.strings.mfaTitle}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="link" onClick={actions.setEditSeal}>
|
<div className="link" onClick={actions.setEditSeal}>
|
||||||
<div className="control">
|
<div className="control">
|
||||||
@ -277,10 +275,10 @@ export function AccountAccess() {
|
|||||||
</div>
|
</div>
|
||||||
<Input.OTP onChange={actions.setCode} />
|
<Input.OTP onChange={actions.setCode} />
|
||||||
<div className="alert">
|
<div className="alert">
|
||||||
{ state.mfaError && state.mfaErrorCode == 'Error: 401' && (
|
{ state.mfaError && state.mfaErrorCode === '401' && (
|
||||||
<span>{state.strings.mfaError}</span>
|
<span>{state.strings.mfaError}</span>
|
||||||
)}
|
)}
|
||||||
{ state.mfaError && state.mfaErrorCode == 'Error: 429' && (
|
{ state.mfaError && state.mfaErrorCode === '429' && (
|
||||||
<span>{state.strings.mfaDisabled}</span>
|
<span>{state.strings.mfaDisabled}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -354,8 +354,8 @@ export function useAccountAccess() {
|
|||||||
updateState({ busy: false, mfaModal: false });
|
updateState({ busy: false, mfaModal: false });
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.log("error code: ", err);
|
const msg = err?.message;
|
||||||
updateState({ busy: false, mfaError: true, mfaErrorCode: err });
|
updateState({ busy: false, mfaError: true, mfaErrorCode: msg });
|
||||||
throw new Error('failed to confirm mfa');
|
throw new Error('failed to confirm mfa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user