InterfaceUseLoginValue

interface UseLoginValue {
    clearForgotPasswordError: (() => void);
    clearLoginError: (() => void);
    codeValidation: {
        isInvalid: boolean;
    };
    forgotPasswordError: null | Error;
    hasSentForgotPasswordCode: boolean;
    hideForgotPassword: (() => void);
    isLoggingIn: boolean;
    isMfaCodeRequired: boolean;
    isPasswordTemporary: boolean;
    isResettingForgottenPassword: boolean;
    isResettingTemporaryPassword: boolean;
    isSendingForgotPasswordCode: boolean;
    isShowingForgotPassword: boolean;
    isSubmittingMfaCode: boolean;
    loginError: null | Error;
    loginWithGoogle: (() => void);
    loginWithUsernamePassword: (() => void);
    newPasswordConfirmedValidation: {
        isInvalid: boolean;
    };
    newPasswordValidation: {
        hasLowercaseLetter: boolean;
        hasMinLength: boolean;
        hasNumber: boolean;
        hasSpecialCharacter: boolean;
        hasUpperCaseLetter: boolean;
        isInvalid: boolean;
    };
    passwordValidation: {
        isInvalid: boolean;
    };
    resetForgottenPassword: (() => void);
    resetTemporaryPassword: (() => void);
    sendForgotPasswordCode: (() => void);
    showForgotPassword: (() => void);
    submitMfaCode: (() => void);
    usernameValidation: {
        isInvalid: boolean;
    };
}

Properties

clearForgotPasswordError: (() => void)

Set forgotPasswordError back to null.

clearLoginError: (() => void)

Set loginError back to null.

codeValidation: {
    isInvalid: boolean;
}

Type declaration

  • isInvalid: boolean

    true if the code argument is invalid.

forgotPasswordError: null | Error

Set if an error occurs while processing sendForgotPasswordCode() or resetForgottenPassword().

hasSentForgotPasswordCode: boolean

true if the forgot password code has been successfully sent to the user.

hideForgotPassword: (() => void)

Set isShowingForgotPassword to false.

isLoggingIn: boolean

true while processing loginWithUsernamePassword().

isMfaCodeRequired: boolean

true if the user logged in using MFA and a code is required to finish the login attempt. Prompt the user for a code and call submitMfaCode().

isPasswordTemporary: boolean

true if the user logged in using a temporary password. Prompt the user for a new password and call resetTemporaryPassword().

isResettingForgottenPassword: boolean

true while processing resetForgottenPassword().

isResettingTemporaryPassword: boolean

true while processing resetTemporaryPassword().

isSendingForgotPasswordCode: boolean

true while processing sendForgotPasswordCode().

isShowingForgotPassword: boolean

true when showing the forgot password flow.

isSubmittingMfaCode: boolean

true while processing submitMfaCode().

loginError: null | Error

Set if an error occurs while processing loginWithUsernamePassword() or resetTemporaryPassword().

loginWithGoogle: (() => void)

Open redirect user to the Google sign-in page.

loginWithUsernamePassword: (() => void)

Attempt to use the username and password arguments to create a session. Will call onLogin() if successful, otherwise will set loginError.

newPasswordConfirmedValidation: {
    isInvalid: boolean;
}

Type declaration

  • isInvalid: boolean

    true if the newPasswordConfirmed argument is invalid (must match the newPassword argument).

newPasswordValidation: {
    hasLowercaseLetter: boolean;
    hasMinLength: boolean;
    hasNumber: boolean;
    hasSpecialCharacter: boolean;
    hasUpperCaseLetter: boolean;
    isInvalid: boolean;
}

Type declaration

  • hasLowercaseLetter: boolean

    true if the newPassword argument has a lowercase letter (required to be valid).

  • hasMinLength: boolean

    true if the newPassword argument has at least the minimum number of characters (required to be valid).

  • hasNumber: boolean

    true if the newPassword argument has a number (required to be valid).

  • hasSpecialCharacter: boolean

    true if the newPassword argument has a special character (required to be valid).

  • hasUpperCaseLetter: boolean

    true if the newPassword argument has an uppercase letter (required to be valid).

  • isInvalid: boolean

    true if the newPassword argument is invalid.

passwordValidation: {
    isInvalid: boolean;
}

Type declaration

  • isInvalid: boolean

    true if the password argument is invalid.

resetForgottenPassword: (() => void)

Attempt to use the code, newPassword, and newPasswordConfirmed arguments to reset the user's password. A failed request will set forgotPasswordError.

resetTemporaryPassword: (() => void)

Attempt to use newPassword and newPasswordConfirmed arguments to reset the user's password and create a session. Will call onLogin() if successful, otherwise will set loginError.

sendForgotPasswordCode: (() => void)

Attempt to use the username argument to start the forgot password process. This will send the user an email with a code to enter. A failed request will set forgotPasswordError.

showForgotPassword: (() => void)

Set isShowingForgotPassword to true.

submitMfaCode: (() => void)

Attempt to use code argument to submit the MFA code and create a session. Will call onLogin() if successful, otherwise will set loginError.

usernameValidation: {
    isInvalid: boolean;
}

Type declaration

  • isInvalid: boolean

    true if the username argument is invalid.