feat(gitea): 增加免密登录按钮,跳转 Gitea OIDC 入口
GiteaSessionConfig 增加 SsoUrl;账号卡片显示免密登录按钮,点击跳转 Gitea 的 /user/oauth2/gerp
This commit is contained in:
1 parent
4ba18370a4
commit
40408b39dc
2 files changed
+11
No files matched your search
@@ -5,6 +5,8 @@ export interface GiteaSessionConfig {
|
||||
BaseUrl: string
|
||||
Org: string
|
||||
OwnerRole: string
|
||||
/** 免密登录入口(OIDC 跳转地址),配置 [gitea_oidc] 后存在 */
|
||||
SsoUrl?: string
|
||||
}
|
||||
|
||||
/** 我的 Gitea 账号信息 */
|
||||
|
||||
@@ -47,6 +47,12 @@ async function init(): Promise<void> {
|
||||
|
||||
onMounted(init)
|
||||
|
||||
/** 免密登录 Gitea:跳转 Gitea 的 OIDC 入口,已登录 GERP 会话自动授权,无需输入 Gitea 密码 */
|
||||
function ssoLogin(): void {
|
||||
if (!session.value?.SsoUrl) return
|
||||
window.location.href = session.value.SsoUrl
|
||||
}
|
||||
|
||||
async function submitApply(): Promise<void> {
|
||||
const f = applyForm
|
||||
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{2,38}$/.test(f.GiteaLogin)) {
|
||||
@@ -165,6 +171,9 @@ async function submitUploadAvatar(): Promise<void> {
|
||||
使用该用户名与密码直接登录,进行代码托管操作。
|
||||
</div>
|
||||
<div class="account-actions">
|
||||
<el-button v-if="session?.SsoUrl" type="primary" :icon="'Link'" @click="ssoLogin">
|
||||
免密登录 Gitea
|
||||
</el-button>
|
||||
<el-button :icon="'Key'" @click="changePwdVisible = true">修改密码</el-button>
|
||||
<el-button :icon="'Picture'" type="primary" plain @click="avatarVisible = true">一键迁移 GERP 头像</el-button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user