mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
parent
eda3084beb
commit
fa776d5fb3
@ -308,7 +308,7 @@ module.exports = {
|
||||
EnterVerificationCode: 'Enter Verification Code',
|
||||
TwoFactorAuthentication: 'Two Factor Authentication',
|
||||
RegisterAuthenticationApp: 'Register authentication App',
|
||||
AuthenticatorAppSunstone: 'Authenticator app (HOTP) [Sunstone]',
|
||||
AuthenticatorAppSunstone: 'Authenticator app (HOTP) [Legacy]',
|
||||
AuthenticatorApp: 'Authenticator app (HOTP)',
|
||||
KeepLoggedIn: 'Keep me logged in',
|
||||
KeepLast: 'Keep Last',
|
||||
|
@ -121,6 +121,7 @@ const Qr = ({
|
||||
className={classes.qr}
|
||||
src={data}
|
||||
alt={Tr(T.ScanThisQr)}
|
||||
data-cy="qrTfa"
|
||||
/>
|
||||
)}
|
||||
</Grid>
|
||||
@ -237,7 +238,18 @@ const Tfa = () => {
|
||||
fireedge?.TWO_FACTOR_AUTH_SECRET) && (
|
||||
<List className={classes.enabled}>
|
||||
{sunstone?.TWO_FACTOR_AUTH_SECRET && (
|
||||
<ListItem>
|
||||
<ListItem
|
||||
secondaryAction={
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
onClick={handleRemoveTfa}
|
||||
data-cy="removeTfa"
|
||||
>
|
||||
<Trash className="icon" />
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<Translate word={T.AuthenticatorAppSunstone} />
|
||||
</ListItem>
|
||||
)}
|
||||
@ -248,7 +260,7 @@ const Tfa = () => {
|
||||
variant="contained"
|
||||
size="small"
|
||||
onClick={handleRemoveTfa}
|
||||
data-cy="addTfa"
|
||||
data-cy="removeTfa"
|
||||
>
|
||||
<Trash className="icon" />
|
||||
</Button>
|
||||
|
@ -243,18 +243,28 @@ const del = (
|
||||
|
||||
const oneConnect = oneConnection(user, password)
|
||||
getUserInfoAuthenticated(oneConnect, next, (data) => {
|
||||
const fireedge = data?.USER?.TEMPLATE?.FIREEDGE
|
||||
if (fireedge) {
|
||||
const template = data?.USER?.TEMPLATE
|
||||
const fireedge = template?.FIREEDGE
|
||||
const sunstone = template?.SUNSTONE
|
||||
|
||||
if (fireedge || sunstone) {
|
||||
let newTemplate = generateNewResourceTemplate(
|
||||
sunstone || {},
|
||||
{},
|
||||
[default2FAOpennebulaTmpVar, default2FAOpennebulaVar],
|
||||
'SUNSTONE=[%1$s]'
|
||||
)
|
||||
|
||||
if (fireedge) {
|
||||
newTemplate = generateNewResourceTemplate(fireedge || {}, {}, [
|
||||
default2FAOpennebulaTmpVar,
|
||||
default2FAOpennebulaVar,
|
||||
])
|
||||
}
|
||||
|
||||
oneConnect({
|
||||
action: Actions.USER_UPDATE,
|
||||
parameters: [
|
||||
parseInt(data.USER.ID, 10),
|
||||
generateNewResourceTemplate(fireedge || {}, {}, [
|
||||
default2FAOpennebulaTmpVar,
|
||||
default2FAOpennebulaVar,
|
||||
]),
|
||||
1,
|
||||
],
|
||||
parameters: [parseInt(data.USER.ID, 10), newTemplate, 1],
|
||||
callback: (err, value) => {
|
||||
responseOpennebula(
|
||||
() => undefined,
|
||||
|
@ -257,8 +257,8 @@ const validate2faAuthentication = (informationUser) => {
|
||||
updaterResponse(httpResponse(accepted, { id: informationUser?.ID }))
|
||||
} else {
|
||||
const secret =
|
||||
template.FIREEDGE[default2FAOpennebulaVar] ||
|
||||
template.SUNSTONE[default2FAOpennebulaVar]
|
||||
template.FIREEDGE?.[default2FAOpennebulaVar] ||
|
||||
template.SUNSTONE?.[default2FAOpennebulaVar]
|
||||
if (!check2Fa(secret, tfatoken)) {
|
||||
updaterResponse(httpResponse(unauthorized, '', 'invalid 2fa token'))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user