Skip to content

Commit

Permalink
fix: oauth login
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Sep 6, 2024
1 parent 0401136 commit d2387a4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
12 changes: 6 additions & 6 deletions projects/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --------- install dependence -----------
FROM node:20.14.0-alpine AS mainDeps
FROM node:20.14.0-alpine AS maindeps
WORKDIR /app

ARG proxy
Expand All @@ -26,10 +26,10 @@ ARG proxy

# copy common node_modules and one project node_modules
COPY package.json pnpm-workspace.yaml .npmrc tsconfig.json ./
COPY --from=mainDeps /app/node_modules ./node_modules
COPY --from=mainDeps /app/packages ./packages
COPY --from=maindeps /app/node_modules ./node_modules
COPY --from=maindeps /app/packages ./packages
COPY ./projects/app ./projects/app
COPY --from=mainDeps /app/projects/app/node_modules ./projects/app/node_modules
COPY --from=maindeps /app/projects/app/node_modules ./projects/app/node_modules

RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories

Expand Down Expand Up @@ -63,9 +63,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/projects/app/.next/server/chunks
COPY --from=builder --chown=nextjs:nodejs /app/projects/app/.next/server/worker /app/projects/app/.next/server/worker

# copy standload packages
COPY --from=mainDeps /app/node_modules/tiktoken ./node_modules/tiktoken
COPY --from=maindeps /app/node_modules/tiktoken ./node_modules/tiktoken
RUN rm -rf ./node_modules/tiktoken/encoders
COPY --from=mainDeps /app/node_modules/@zilliz/milvus2-sdk-node ./node_modules/@zilliz/milvus2-sdk-node
COPY --from=maindeps /app/node_modules/@zilliz/milvus2-sdk-node ./node_modules/@zilliz/milvus2-sdk-node


# copy package.json to version file
Expand Down
9 changes: 7 additions & 2 deletions projects/app/src/pages/login/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/utils/i18n';
import { getErrText } from '@fastgpt/global/common/error/utils';
import { useTranslation } from 'next-i18next';
import { useMount } from 'ahooks';

const provider = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -104,9 +103,15 @@ const provider = () => {
} else {
authCode(code);
}
}, [code, error, loginStore, state]);
}, []);

return <Loading />;
};

export default provider;

export async function getServerSideProps(context: any) {
return {
props: { ...(await serviceSideProps(context)) }
};
}
9 changes: 8 additions & 1 deletion projects/app/src/pages/login/sso.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ssoLogin } from '@/web/support/user/api';
import Loading from '@fastgpt/web/components/common/MyLoading';
import { useTranslation } from 'next-i18next';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { serviceSideProps } from '@/web/common/utils/i18n';

const provider = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -39,9 +40,15 @@ const provider = () => {
clearToken();
handleSSO();
}
}, [handleSSO, query]);
}, []);

return <Loading />;
};

export default provider;

export async function getServerSideProps(context: any) {
return {
props: { ...(await serviceSideProps(context)) }
};
}

0 comments on commit d2387a4

Please sign in to comment.