mirror of https://gitee.com/answerdev/answer.git
fix: oauth asjustment
This commit is contained in:
parent
3285d54ee9
commit
0529c10c54
|
@ -162,7 +162,7 @@ const Index: React.FC = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isInactive = searchParams.get('status');
|
const isInactive = searchParams.get('status');
|
||||||
|
|
||||||
if ((storeUser.id && storeUser.mail_status === 2) || isInactive) {
|
if (storeUser.id && (storeUser.mail_status === 2 || isInactive)) {
|
||||||
setStep(2);
|
setStep(2);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { loggedUserInfoStore } from '@/stores';
|
||||||
import { getLoggedUserInfo } from '@/services';
|
import { getLoggedUserInfo } from '@/services';
|
||||||
import Storage from '@/utils/storage';
|
import Storage from '@/utils/storage';
|
||||||
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';
|
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';
|
||||||
|
import { guard } from '@/utils';
|
||||||
|
|
||||||
const Index: FC = () => {
|
const Index: FC = () => {
|
||||||
const { t } = useTranslation('translation', { keyPrefix: 'page_title' });
|
const { t } = useTranslation('translation', { keyPrefix: 'page_title' });
|
||||||
|
@ -22,9 +23,15 @@ const Index: FC = () => {
|
||||||
Storage.set(LOGGED_TOKEN_STORAGE_KEY, token);
|
Storage.set(LOGGED_TOKEN_STORAGE_KEY, token);
|
||||||
getLoggedUserInfo().then((res) => {
|
getLoggedUserInfo().then((res) => {
|
||||||
updateUser(res);
|
updateUser(res);
|
||||||
|
const userStat = guard.deriveLoginState();
|
||||||
|
if (userStat.isNotActivated) {
|
||||||
|
// inactive
|
||||||
|
navigate('/users/login?status=inactive', { replace: true });
|
||||||
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loginRedirect();
|
loginRedirect();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
navigate('/', { replace: true });
|
navigate('/', { replace: true });
|
||||||
|
|
Loading…
Reference in New Issue