|
|
@@ -26,7 +26,7 @@
|
|
26
|
26
|
<div v-for="(option, index) in options" :key="index" class="oidc-option">
|
|
27
|
27
|
<el-button @click="handleOIDCLogin(option.name)" class="oidc-btn">
|
|
28
|
28
|
<img :src="getProviderImage(option.name)" alt="provider" class="oidc-icon" />
|
|
29
|
|
- {{ T(option.name) }}
|
|
|
29
|
+ <span>{{ T(option.name) }}</span>
|
|
30
|
30
|
</el-button>
|
|
31
|
31
|
</div>
|
|
32
|
32
|
</div>
|
|
|
@@ -105,21 +105,9 @@ const getProviderImage = (provider) => {
|
|
105
|
105
|
|
|
106
|
106
|
const loadLoginOptions = async () => {
|
|
107
|
107
|
try {
|
|
108
|
|
- const res = await loginOptions().catch(() => []);
|
|
109
|
|
- if (!Array.isArray(res) || !res.length) return console.warn('No valid response received');
|
|
110
|
|
-
|
|
111
|
|
- const jsonPart = res[0].split('/')[1];
|
|
112
|
|
- if (!jsonPart) return console.error('Invalid input string:', res[0]);
|
|
113
|
|
-
|
|
114
|
|
- // const ops = JSON.parse(jsonPart).map(option => ({ name: option.name }));
|
|
115
|
|
- // 不确定怎么处理webauth,不显示
|
|
116
|
|
- // 解析 JSON,并过滤掉 "webauth" 类型的选项
|
|
117
|
|
- const ops = JSON.parse(jsonPart)
|
|
118
|
|
- .filter(option => option.name !== "webauth") // 排除 "webauth" 类型的选项
|
|
119
|
|
- .map(option => ({ name: option.name })); // 创建新的对象数组
|
|
120
|
|
- if (!ops.length) return;
|
|
121
|
|
-
|
|
122
|
|
- options.push(...ops);
|
|
|
108
|
+ const res = await loginOptions().catch(_ => false);
|
|
|
109
|
+ if(!res || !res.data) return console.error('No valid response received');
|
|
|
110
|
+ res.data.map(option => (options.push({ name: option }))); // 创建新的对象数组
|
|
123
|
111
|
} catch (error) {
|
|
124
|
112
|
console.error('Error loading login options:', error.message);
|
|
125
|
113
|
}
|
|
|
@@ -141,6 +129,7 @@ onMounted(async () => {
|
|
141
|
129
|
loadLoginOptions(); // 组件挂载后调用登录选项加载函数
|
|
142
|
130
|
}
|
|
143
|
131
|
});
|
|
|
132
|
+
|
|
144
|
133
|
</script>
|
|
145
|
134
|
|
|
146
|
135
|
<style scoped lang="scss">
|
|
|
@@ -230,6 +219,7 @@ h1 {
|
|
230
|
219
|
.oidc-icon {
|
|
231
|
220
|
width: 24px;
|
|
232
|
221
|
height: 24px;
|
|
|
222
|
+ margin-right: 10px;
|
|
233
|
223
|
}
|
|
234
|
224
|
|
|
235
|
225
|
.login-logo {
|
|
|
@@ -255,4 +245,4 @@ h1 {
|
|
255
|
245
|
}
|
|
256
|
246
|
}
|
|
257
|
247
|
}
|
|
258
|
|
-</style>
|
|
|
248
|
+</style>
|