fix: oauth asjustment

This commit is contained in:
shuai 2023-01-13 15:11:26 +08:00
parent 3285d54ee9
commit 0529c10c54
2 changed files with 11 additions and 4 deletions

View File

@ -162,7 +162,7 @@ const Index: React.FC = () => {
useEffect(() => {
const isInactive = searchParams.get('status');
if ((storeUser.id && storeUser.mail_status === 2) || isInactive) {
if (storeUser.id && (storeUser.mail_status === 2 || isInactive)) {
setStep(2);
}
}, []);

View File

@ -7,6 +7,7 @@ import { loggedUserInfoStore } from '@/stores';
import { getLoggedUserInfo } from '@/services';
import Storage from '@/utils/storage';
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';
import { guard } from '@/utils';
const Index: FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'page_title' });
@ -22,9 +23,15 @@ const Index: FC = () => {
Storage.set(LOGGED_TOKEN_STORAGE_KEY, token);
getLoggedUserInfo().then((res) => {
updateUser(res);
setTimeout(() => {
loginRedirect();
}, 0);
const userStat = guard.deriveLoginState();
if (userStat.isNotActivated) {
// inactive
navigate('/users/login?status=inactive', { replace: true });
} else {
setTimeout(() => {
loginRedirect();
}, 0);
}
});
} else {
navigate('/', { replace: true });