Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: oauth asjustment

shuai0529c10c545f
diff --git a/ui/src/pages/Users/Login/index.tsx b/ui/src/pages/Users/Login/index.tsx
index afde7d34..c046bc5a 100644
--- a/ui/src/pages/Users/Login/index.tsx
+++ b/ui/src/pages/Users/Login/index.tsx
@@ -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);
}
}, []);
diff --git a/ui/src/pages/Users/OauthCallback/index.tsx b/ui/src/pages/Users/OauthCallback/index.tsx
index 35f57dca..2008ec45 100644
--- a/ui/src/pages/Users/OauthCallback/index.tsx
+++ b/ui/src/pages/Users/OauthCallback/index.tsx
@@ -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 });