mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
store oauth 2.0 user info in token context instead of being passed through frontend parameters
This commit is contained in:
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Le fichier d'image pour la reconnaissance IA est vide",
|
||||
"exceed the maximum size of image file for AI recognition": "L'image téléchargée pour la reconnaissance IA dépasse la taille de fichier maximale autorisée",
|
||||
"no transaction information detected": "Aucune information de transaction détectée",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "AI 인식을 위한 이미지 파일이 비어 있습니다.",
|
||||
"exceed the maximum size of image file for AI recognition": "AI 인식을 위한 업로드된 이미지가 허용된 최대 파일 크기를 초과합니다.",
|
||||
"no transaction information detected": "거래 정보가 감지되지 않았습니다.",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "ไฟล์รูปภาพสำหรับการจดจำด้วย AI ว่างเปล่า",
|
||||
"exceed the maximum size of image file for AI recognition": "ไฟล์รูปภาพสำหรับการจดจำด้วย AI เกินขนาดสูงสุดที่อนุญาต",
|
||||
"no transaction information detected": "ไม่พบข้อมูลธุรกรรม",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
+2
-1
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "Image for AI recognition file is empty",
|
||||
"exceed the maximum size of image file for AI recognition": "The uploaded image for AI recognition exceeds the maximum allowed file size",
|
||||
"no transaction information detected": "No transaction information detected",
|
||||
"user external auth is not found": "User external authentication is not found",
|
||||
"user external auth is not found": "User external authentication data not found",
|
||||
"user external auth already exists": "User external authentication data already exists, please unlink it first",
|
||||
"oauth2 not enabled": "OAuth 2.0 is not enabled",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 auto registration is not enabled",
|
||||
"invalid oauth2 login request": "Invalid OAuth 2.0 login request",
|
||||
|
||||
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "用于AI识别的图片为空",
|
||||
"exceed the maximum size of image file for AI recognition": "用于AI识别的图片超出了允许的最大文件大小",
|
||||
"no transaction information detected": "没有检测到交易信息",
|
||||
"user external auth is not found": "用户外部认证信息不存在",
|
||||
"user external auth is not found": "找不到用户外部认证数据",
|
||||
"user external auth already exists": "用户外部认证数据已存在,请先解绑",
|
||||
"oauth2 not enabled": "OAuth 2.0 没有启用",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 自动注册没有启用",
|
||||
"invalid oauth2 login request": "无效的 OAuth 2.0 登录请求",
|
||||
|
||||
@@ -1241,7 +1241,8 @@
|
||||
"image for AI recognition is empty": "用於AI識別的圖片檔案為空",
|
||||
"exceed the maximum size of image file for AI recognition": "用於AI識別的圖片超出了允許的最大檔案大小",
|
||||
"no transaction information detected": "沒有檢測到交易資訊",
|
||||
"user external auth is not found": "使用者外部驗證資訊不存在",
|
||||
"user external auth is not found": "找不到使用者外部驗證資料",
|
||||
"user external auth already exists": "使用者外部驗證資料已存在,請先解除連結",
|
||||
"oauth2 not enabled": "OAuth 2.0 未啟用",
|
||||
"oauth2 auto registration not enabled": "OAuth 2.0 自動註冊未啟用",
|
||||
"invalid oauth2 login request": "無效的 OAuth 2.0 登入請求",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export interface OAuth2CallbackLoginRequest {
|
||||
readonly provider?: string;
|
||||
readonly password?: string;
|
||||
}
|
||||
|
||||
+1
-2
@@ -191,11 +191,10 @@ export const useRootStore = defineStore('root', () => {
|
||||
});
|
||||
}
|
||||
|
||||
function authorizeOAuth2({ provider, password, token }: { provider: string, password?: string, token: string }): Promise<AuthResponse> {
|
||||
function authorizeOAuth2({ password, token }: { password?: string, token: string }): Promise<AuthResponse> {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.authorizeOAuth2({
|
||||
req: {
|
||||
provider,
|
||||
password
|
||||
},
|
||||
token
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<v-card variant="flat" class="w-100 mt-0 px-4 pt-12" max-width="500">
|
||||
<v-card-text>
|
||||
<h4 class="text-h4 mb-2">{{ oauth2LoginDisplayName }}</h4>
|
||||
<p class="mb-0" v-if="!error && platform && provider && token && !userName">{{ tt('Logging in...') }}</p>
|
||||
<p class="mb-0" v-if="!error && platform && token && !userName">{{ tt('Logging in...') }}</p>
|
||||
<p class="mb-0" v-else-if="!error && userName">{{ tt('format.misc.oauth2bindTip', { providerName: oauth2ProviderDisplayName, userName: userName }) }}</p>
|
||||
<p class="mb-0" v-else-if="error">{{ te({ error }) }}</p>
|
||||
<p class="mb-0" v-else>{{ tt('An error occurred') }}</p>
|
||||
@@ -113,7 +113,6 @@ import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { navigateToHomePage } from '@/lib/web.ts';
|
||||
import {
|
||||
isUserVerifyEmailEnabled,
|
||||
getOAuth2Provider,
|
||||
getOIDCCustomDisplayNames
|
||||
} from '@/lib/server_settings.ts';
|
||||
|
||||
@@ -135,7 +134,12 @@ const props = defineProps<{
|
||||
const router = useRouter();
|
||||
const theme = useTheme();
|
||||
|
||||
const { tt, te, getLocalizedOAuth2ProviderName, getLocalizedOAuth2LoginText } = useI18n();
|
||||
const {
|
||||
tt,
|
||||
te,
|
||||
getLocalizedOAuth2ProviderName,
|
||||
getLocalizedOAuth2LoginText
|
||||
} = useI18n();
|
||||
|
||||
const rootStore = useRootStore();
|
||||
|
||||
@@ -149,8 +153,8 @@ const {
|
||||
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
||||
|
||||
const isDarkMode = computed<boolean>(() => theme.global.name.value === ThemeType.Dark);
|
||||
const oauth2ProviderDisplayName = computed<string>(() => getLocalizedOAuth2ProviderName(getOAuth2Provider(), getOIDCCustomDisplayNames()));
|
||||
const oauth2LoginDisplayName = computed<string>(() => getLocalizedOAuth2LoginText(getOAuth2Provider(), getOIDCCustomDisplayNames()));
|
||||
const oauth2ProviderDisplayName = computed<string>(() => getLocalizedOAuth2ProviderName(props.provider ?? '', getOIDCCustomDisplayNames()));
|
||||
const oauth2LoginDisplayName = computed<string>(() => getLocalizedOAuth2LoginText(props.provider ?? '', getOIDCCustomDisplayNames()));
|
||||
|
||||
const error = computed<ErrorResponse | undefined>(() => {
|
||||
if (props.errorCode && props.errorMessage) {
|
||||
@@ -196,7 +200,6 @@ function verifyAndLogin(): void {
|
||||
logining.value = true;
|
||||
|
||||
rootStore.authorizeOAuth2({
|
||||
provider: props.provider || '',
|
||||
password: password.value,
|
||||
token: props.token || ''
|
||||
}).then(authResponse => {
|
||||
@@ -217,11 +220,10 @@ function verifyAndLogin(): void {
|
||||
});
|
||||
}
|
||||
|
||||
if (!error.value && props.platform && props.provider && props.token && !props.userName) {
|
||||
if (!error.value && props.platform && props.token && !props.userName) {
|
||||
logining.value = true;
|
||||
|
||||
rootStore.authorizeOAuth2({
|
||||
provider: props.provider,
|
||||
token: props.token
|
||||
}).then(authResponse => {
|
||||
logining.value = false;
|
||||
|
||||
Reference in New Issue
Block a user