fix: possible two factor secret bug
This commit is contained in:
parent
7680b2f85a
commit
2062413c75
4 changed files with 8 additions and 7 deletions
|
|
@ -186,12 +186,12 @@ const disableUser = (code, id, context) => {
|
||||||
|
|
||||||
const createResetPasswordToken = (code, userID, context) => {
|
const createResetPasswordToken = (code, userID, context) => {
|
||||||
const action = () => users.createAuthToken(userID, 'reset_password')
|
const action = () => users.createAuthToken(userID, 'reset_password')
|
||||||
return executeProtectedAction(code, id, context, action)
|
return executeProtectedAction(code, userID, context, action)
|
||||||
}
|
}
|
||||||
|
|
||||||
const createReset2FAToken = (code, userID, context) => {
|
const createReset2FAToken = (code, userID, context) => {
|
||||||
const action = () => users.createAuthToken(userID, 'reset_twofa')
|
const action = () => users.createAuthToken(userID, 'reset_twofa')
|
||||||
return executeProtectedAction(code, id, context, action)
|
return executeProtectedAction(code, userID, context, action)
|
||||||
}
|
}
|
||||||
|
|
||||||
const createRegisterToken = (username, role) => {
|
const createRegisterToken = (username, role) => {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { Button } from 'src/components/buttons'
|
||||||
import { TextInput, RadioGroup } from 'src/components/inputs/formik'
|
import { TextInput, RadioGroup } from 'src/components/inputs/formik'
|
||||||
import { H1, H3, Info2, P, Mono } from 'src/components/typography'
|
import { H1, H3, Info2, P, Mono } from 'src/components/typography'
|
||||||
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
||||||
|
import { URI } from 'src/utils/apollo'
|
||||||
|
|
||||||
import styles from '../UserManagement.styles'
|
import styles from '../UserManagement.styles'
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ const CreateUserModal = ({ showModal, toggleModal }) => {
|
||||||
|
|
||||||
const [createUser, { error }] = useMutation(CREATE_USER, {
|
const [createUser, { error }] = useMutation(CREATE_USER, {
|
||||||
onCompleted: ({ createRegisterToken: token }) => {
|
onCompleted: ({ createRegisterToken: token }) => {
|
||||||
setCreateUserURL(`https://localhost:3001/register?t=${token.token}`)
|
setCreateUserURL(`${URI}/register?t=${token.token}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import React, { useEffect, useState } from 'react'
|
||||||
import Modal from 'src/components/Modal'
|
import Modal from 'src/components/Modal'
|
||||||
import { Info2, P, Mono } from 'src/components/typography'
|
import { Info2, P, Mono } from 'src/components/typography'
|
||||||
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
||||||
|
import { URI } from 'src/utils/apollo'
|
||||||
|
|
||||||
import styles from '../UserManagement.styles'
|
import styles from '../UserManagement.styles'
|
||||||
|
|
||||||
|
|
@ -36,7 +37,7 @@ const Reset2FAModal = ({
|
||||||
CREATE_RESET_2FA_TOKEN,
|
CREATE_RESET_2FA_TOKEN,
|
||||||
{
|
{
|
||||||
onCompleted: ({ createReset2FAToken: token }) => {
|
onCompleted: ({ createReset2FAToken: token }) => {
|
||||||
setReset2FAUrl(`https://localhost:3001/reset2fa?t=${token.token}`)
|
setReset2FAUrl(`${URI}/reset2fa?t=${token.token}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import React, { useEffect, useState } from 'react'
|
||||||
import Modal from 'src/components/Modal'
|
import Modal from 'src/components/Modal'
|
||||||
import { Info2, P, Mono } from 'src/components/typography'
|
import { Info2, P, Mono } from 'src/components/typography'
|
||||||
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard'
|
||||||
|
import { URI } from 'src/utils/apollo'
|
||||||
|
|
||||||
import styles from '../UserManagement.styles'
|
import styles from '../UserManagement.styles'
|
||||||
|
|
||||||
|
|
@ -39,9 +40,7 @@ const ResetPasswordModal = ({
|
||||||
CREATE_RESET_PASSWORD_TOKEN,
|
CREATE_RESET_PASSWORD_TOKEN,
|
||||||
{
|
{
|
||||||
onCompleted: ({ createResetPasswordToken: token }) => {
|
onCompleted: ({ createResetPasswordToken: token }) => {
|
||||||
setResetPasswordUrl(
|
setResetPasswordUrl(`${URI}/resetpassword?t=${token.token}`)
|
||||||
`https://localhost:3001/resetpassword?t=${token.token}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue