Skip to content

Commit

Permalink
perf: 仅本地用户允许使用 passkey
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler authored and BaiJiangJie committed Oct 11, 2023
1 parent 4c3673a commit fd018dc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/Apps/UserConfirmDialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export default {
data() {
return {
title: this.$t('common.CurrentUserVerify'),
smsBtnText: this.$t('common.SendVerificationCode'),
smsWidth: 0,
subTypeSelected: '',
inputPlaceholder: '',
smsBtnText: this.$t('common.SendVerificationCode'),
smsBtnDisabled: false,
confirmTypeRequired: '',
subTypeChoices: [],
Expand All @@ -119,7 +119,7 @@ export default {
watch: {
visible(val) {
if (!val) {
this.$emit('onConfirmCancel', true)
this.$emit('onConfirmFinal', true)
}
}
},
Expand Down Expand Up @@ -189,6 +189,7 @@ export default {
}).catch((e) => {
this.$emit('onHandlerError', e)
}).finally(() => {
this.$emit('onConfirmFinal')
this.visible = false
})
},
Expand Down
7 changes: 6 additions & 1 deletion src/i18n/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2313,5 +2313,10 @@
"applets": {
"PublishStatus": "Publish status",
"NoPublished": "Unpublished"
},
"profile": {
"CreateAccessKey": "Create Access key",
"ApiKeyWarning": "To reduce the risk of AccessKey exposure, Secret is provided only during creation and cannot be queried again later. Please keep it safe.",
"PasskeyAddDisableInfo": "Your authentication source is {source}, and Passkey addition is not supported."
}
}
}
9 changes: 7 additions & 2 deletions src/i18n/langs/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@
"ratio": "スケール",
"run": "実行",
"runAs": "実行ユーザー",
"runningPath":"実行パス",
"runningPath": "実行パス",
"runTimes": "実行回数",
"selectAssetsMessage": "左側の資産を選択し、実行するシステムユーザーを選択し、コマンドを一括実行します",
"selectedAssets": "選択済アセット:",
Expand Down Expand Up @@ -2304,5 +2304,10 @@
"applets": {
"PublishStatus": "投稿ステータス",
"NoPublished": "未発表"
},
"profile": {
"CreateAccessKey": "Create Access key",
"ApiKeyWarning": "AccessKeyの漏洩リスクを低減するため、Secretは作成時にのみ提供され、後で再度クエリできません。安全に保管してください。",
"PasskeyAddDisableInfo": "あなたの認証元は {source} であり、Passkeyの追加はサポートされていません。"
}
}
}
3 changes: 2 additions & 1 deletion src/i18n/langs/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,8 @@
},
"profile": {
"CreateAccessKey": "创建访问密钥",
"ApiKeyWarning": "为降低 AccessKey 泄露的风险,只在创建时提供 Secret,后续不可再进行查询,请妥善保存。"
"ApiKeyWarning": "为降低 AccessKey 泄露的风险,只在创建时提供 Secret,后续不可再进行查询,请妥善保存。",
"PasskeyAddDisableInfo": "你的认证来源是 {source}, 不支持添加 Passkey"
},
"users": {
"LunaSettingUpdate": "Luna 配置设置",
Expand Down
16 changes: 14 additions & 2 deletions src/views/profile/PassKey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
:title="$tc('auth.AddPassKey')"
:visible.sync="dialogVisible"
>
<AutoDataForm v-bind="form" @submit="onAddConfirm" />
<el-alert v-if="!isLocalUser" :closable="false" class="source-alert" type="error">
{{ $t('profile.PasskeyAddDisableInfo', {source: source.label}) }}
</el-alert>
<AutoDataForm v-else v-bind="form" @submit="onAddConfirm" />
</Dialog>
</div>
</template>
Expand Down Expand Up @@ -115,6 +118,12 @@ export default {
computed: {
getRefsListTable() {
return this.$refs.GenericListTable.$refs.ListTable.$refs.ListTable || {}
},
isLocalUser() {
return this.source?.value === 'local'
},
source() {
return this.$store.getters.currentUser?.source
}
},
methods: {
Expand Down Expand Up @@ -149,5 +158,8 @@ export default {
}
</script>
<style scoped>
<style lang='scss' scoped>
.source-alert >>> .el-alert__content {
text-align: center;
}
</style>

0 comments on commit fd018dc

Please sign in to comment.