[WEB-1309] fix: auth fixes (#4456)
* dev: magic link login and email password disable * dev: user account deactivation * dev: change nginx conf routes * feat: changemod space * fix: space app dir fixes * dev: invalidate cache for instances when creating workspace * dev: update email templates for test email * dev: fix build errors * fix: auth fixes and improvement (#4452) * chore: change password api updated and missing password error code added * chore: auth helper updated * chore: disable send code input suggestion * chore: change password function updated * fix: application error on sign in page * chore: change password validation added and enhancement * dev: space base path in web * dev: admin user deactivated * dev: user and instance admin session endpoint * fix: last_workspace_id endpoint updated * fix: magic sign in and email password check added --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: guru_sainath <gurusainath007@gmail.com>
This commit is contained in:
parent
ab6f1ef780
commit
9b7b23f5a2
44 changed files with 1114 additions and 319 deletions
|
|
@ -68,6 +68,10 @@ export const AuthRoot: FC<TAuthRoot> = observer((props) => {
|
|||
}
|
||||
}, [error_code, authMode]);
|
||||
|
||||
const isSMTPConfigured = instance?.config?.is_smtp_configured || false;
|
||||
const isMagicLoginEnabled = instance?.config?.is_magic_login_enabled || false;
|
||||
const isEmailPasswordEnabled = instance?.config?.is_email_password_enabled || false;
|
||||
|
||||
// submit handler- email verification
|
||||
const handleEmailVerification = async (data: IEmailCheckData) => {
|
||||
setEmail(data.email);
|
||||
|
|
@ -80,19 +84,21 @@ export const AuthRoot: FC<TAuthRoot> = observer((props) => {
|
|||
if (response.is_password_autoset) {
|
||||
setAuthStep(EAuthSteps.UNIQUE_CODE);
|
||||
generateEmailUniqueCode(data.email);
|
||||
} else {
|
||||
} else if (isEmailPasswordEnabled) {
|
||||
setIsPasswordAutoset(false);
|
||||
setAuthStep(EAuthSteps.PASSWORD);
|
||||
}
|
||||
} else {
|
||||
if (instance && instance?.config?.is_smtp_configured) {
|
||||
if (isSMTPConfigured && isMagicLoginEnabled) {
|
||||
setAuthStep(EAuthSteps.UNIQUE_CODE);
|
||||
generateEmailUniqueCode(data.email);
|
||||
} else setAuthStep(EAuthSteps.PASSWORD);
|
||||
} else if (isEmailPasswordEnabled) {
|
||||
setAuthStep(EAuthSteps.PASSWORD);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorhandler = authErrorHandler(error?.error_code.toString(), data?.email || undefined);
|
||||
const errorhandler = authErrorHandler(error?.error_code?.toString(), data?.email || undefined);
|
||||
if (errorhandler?.type) setErrorInfo(errorhandler);
|
||||
});
|
||||
};
|
||||
|
|
@ -113,8 +119,6 @@ export const AuthRoot: FC<TAuthRoot> = observer((props) => {
|
|||
const isOAuthEnabled =
|
||||
(instance?.config && (instance?.config?.is_google_enabled || instance?.config?.is_github_enabled)) || false;
|
||||
|
||||
const isSMTPConfigured = (instance?.config && instance?.config?.is_smtp_configured) || false;
|
||||
|
||||
return (
|
||||
<div className="relative flex flex-col space-y-6">
|
||||
<AuthHeader
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue