mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 15:40:47 +00:00
finalized signup/signin ux regarding redirects
This commit is contained in:
@@ -33,15 +33,15 @@ export default function PasswordInputStep({
|
||||
const handleLogin = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const isLoginSuccessful = await attemptLogin({
|
||||
const loginAttempt = await attemptLogin({
|
||||
email,
|
||||
password
|
||||
});
|
||||
|
||||
if (isLoginSuccessful && isLoginSuccessful.success) {
|
||||
if (loginAttempt && loginAttempt.success) {
|
||||
// case: login was successful
|
||||
|
||||
if (isLoginSuccessful.mfaEnabled) {
|
||||
if (loginAttempt.mfaEnabled) {
|
||||
// case: login requires MFA step
|
||||
setStep(2);
|
||||
setIsLoading(false);
|
||||
|
||||
@@ -167,6 +167,7 @@ export default function UserInfoStep({
|
||||
// unset signup JWT token and set JWT token
|
||||
SecurityClient.setSignupToken('');
|
||||
SecurityClient.setToken(response.token);
|
||||
SecurityClient.setProviderAuthToken('');
|
||||
|
||||
saveTokenToLocalStorage({
|
||||
publicKey,
|
||||
|
||||
@@ -91,7 +91,9 @@ const attemptLogin = async (
|
||||
token
|
||||
) {
|
||||
// case: MFA is not enabled
|
||||
|
||||
|
||||
// unset provider auth token in case it was used
|
||||
SecurityClient.setProviderAuthToken('');
|
||||
// set JWT token
|
||||
SecurityClient.setToken(token);
|
||||
|
||||
|
||||
@@ -36,7 +36,10 @@ const attemptLoginMfa = async ({
|
||||
}, async () => {
|
||||
try {
|
||||
const clientPublicKey = client.getPublicKey();
|
||||
const { salt } = await login1(email, clientPublicKey);
|
||||
const { salt } = await login1({
|
||||
email,
|
||||
clientPublicKey,
|
||||
});
|
||||
|
||||
const {
|
||||
encryptionVersion,
|
||||
@@ -56,6 +59,7 @@ const attemptLoginMfa = async ({
|
||||
// unset temporary (MFA) JWT token and set JWT token
|
||||
SecurityClient.setMfaToken('');
|
||||
SecurityClient.setToken(token);
|
||||
SecurityClient.setProviderAuthToken('');
|
||||
|
||||
const privateKey = await KeyService.decryptPrivateKey({
|
||||
encryptionVersion,
|
||||
|
||||
Reference in New Issue
Block a user