mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 13:43:42 +08:00
🔖 chore: profile page displays icons based on whether third-party login is enabled. (#227)
* feat(系统设置&登录): 修改飞书登录是否启用判断逻辑和设置选项 1. 系统增加是否开启飞书登录选项 2. 登录使用通过系统设置判断是否启用飞书 * perf(用户中心): 优化用户中心绑定的第三方登录是否绑定判断和展示方式 优化用户中心绑定的第三方登录是否绑定判断和展示方式: - 系统启动了指定登录方式并且用户已经绑定该方式则icon高亮,没绑定则默认颜色显示; - 系统没有启动指定的登录方式则不显示指定登录方式icon
This commit is contained in:
@@ -147,6 +147,13 @@ func getLarkUserInfoByCode(code string) (*LarkUser, error) {
|
||||
}
|
||||
|
||||
func LarkOAuth(c *gin.Context) {
|
||||
if !common.LarkAuthEnabled {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "管理员未开启通过飞书登录以及注册",
|
||||
"success": false,
|
||||
})
|
||||
return
|
||||
}
|
||||
session := sessions.Default(c)
|
||||
state := c.Query("state")
|
||||
if state == "" || session.Get("oauth_state") == nil || state != session.Get("oauth_state").(string) {
|
||||
@@ -220,6 +227,13 @@ func LarkOAuth(c *gin.Context) {
|
||||
}
|
||||
|
||||
func LarkBind(c *gin.Context) {
|
||||
if !common.LarkAuthEnabled {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "管理员未开启通过飞书登录以及注册",
|
||||
"success": false,
|
||||
})
|
||||
return
|
||||
}
|
||||
code := c.Query("code")
|
||||
larkUser, err := getLarkUserInfoByCode(code)
|
||||
if err != nil {
|
||||
|
||||
@@ -28,6 +28,7 @@ func GetStatus(c *gin.Context) {
|
||||
"email_verification": common.EmailVerificationEnabled,
|
||||
"github_oauth": common.GitHubOAuthEnabled,
|
||||
"github_client_id": common.GitHubClientId,
|
||||
"lark_login": common.LarkAuthEnabled,
|
||||
"lark_client_id": common.LarkClientId,
|
||||
"system_name": common.SystemName,
|
||||
"logo": common.Logo,
|
||||
|
||||
Reference in New Issue
Block a user