@@ -5,6 +5,7 @@ app:
|
|||||||
show-swagger: 0 # 1:启用 0:禁用
|
show-swagger: 0 # 1:启用 0:禁用
|
||||||
token-expire: 360000
|
token-expire: 360000
|
||||||
web-sso: true #web auth sso
|
web-sso: true #web auth sso
|
||||||
|
disable-pwd-login: false #禁用密码登录
|
||||||
admin:
|
admin:
|
||||||
title: "RustDesk Api Admin"
|
title: "RustDesk Api Admin"
|
||||||
hello-file: "./conf/admin/hello.html" #优先使用file
|
hello-file: "./conf/admin/hello.html" #优先使用file
|
||||||
|
|||||||
+6
-5
@@ -13,11 +13,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
WebClient int `mapstructure:"web-client"`
|
WebClient int `mapstructure:"web-client"`
|
||||||
Register bool `mapstructure:"register"`
|
Register bool `mapstructure:"register"`
|
||||||
ShowSwagger int `mapstructure:"show-swagger"`
|
ShowSwagger int `mapstructure:"show-swagger"`
|
||||||
TokenExpire int `mapstructure:"token-expire"`
|
TokenExpire int `mapstructure:"token-expire"`
|
||||||
WebSso bool `mapstructure:"web-sso"`
|
WebSso bool `mapstructure:"web-sso"`
|
||||||
|
DisablePwdLogin bool `mapstructure:"disable-pwd-login"`
|
||||||
}
|
}
|
||||||
type Admin struct {
|
type Admin struct {
|
||||||
Title string `mapstructure:"title"`
|
Title string `mapstructure:"title"`
|
||||||
|
|||||||
@@ -152,6 +152,10 @@ var loginLimiter = NewLoginLimiter(3, 5*time.Minute)
|
|||||||
// @Router /admin/login [post]
|
// @Router /admin/login [post]
|
||||||
// @Security token
|
// @Security token
|
||||||
func (ct *Login) Login(c *gin.Context) {
|
func (ct *Login) Login(c *gin.Context) {
|
||||||
|
if global.Config.App.DisablePwdLogin {
|
||||||
|
response.Fail(c, 101, response.TranslateMsg(c, "PwdLoginDisabled"))
|
||||||
|
return
|
||||||
|
}
|
||||||
f := &admin.Login{}
|
f := &admin.Login{}
|
||||||
err := c.ShouldBindJSON(f)
|
err := c.ShouldBindJSON(f)
|
||||||
clientIp := c.ClientIP()
|
clientIp := c.ClientIP()
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ type Login struct {
|
|||||||
// @Failure 500 {object} response.ErrorResponse
|
// @Failure 500 {object} response.ErrorResponse
|
||||||
// @Router /login [post]
|
// @Router /login [post]
|
||||||
func (l *Login) Login(c *gin.Context) {
|
func (l *Login) Login(c *gin.Context) {
|
||||||
|
if global.Config.App.DisablePwdLogin {
|
||||||
|
response.Error(c, response.TranslateMsg(c, "PwdLoginDisabled"))
|
||||||
|
return
|
||||||
|
}
|
||||||
f := &api.LoginForm{}
|
f := &api.LoginForm{}
|
||||||
err := c.ShouldBindJSON(f)
|
err := c.ShouldBindJSON(f)
|
||||||
//fmt.Println(f)
|
//fmt.Println(f)
|
||||||
|
|||||||
@@ -133,3 +133,8 @@ other = "Captcha required."
|
|||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "Captcha error."
|
one = "Captcha error."
|
||||||
other = "Captcha error."
|
other = "Captcha error."
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "Password login disabled."
|
||||||
|
other = "Password login disabled."
|
||||||
@@ -141,4 +141,9 @@ other = "Captcha requerido."
|
|||||||
[CaptchaError]
|
[CaptchaError]
|
||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "Error de captcha."
|
one = "Error de captcha."
|
||||||
other = "Error de captcha."
|
other = "Error de captcha."
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "Inicio de sesión con contraseña deshabilitado."
|
||||||
|
other = "Inicio de sesión con contraseña deshabilitado."
|
||||||
@@ -142,3 +142,8 @@ other = "Captcha requis."
|
|||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "Erreur de captcha."
|
one = "Erreur de captcha."
|
||||||
other = "Erreur de captcha."
|
other = "Erreur de captcha."
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "Connexion par mot de passe désactivée."
|
||||||
|
other = "Connexion par mot de passe désactivée."
|
||||||
@@ -135,4 +135,9 @@ other = "Captcha가 필요합니다."
|
|||||||
[CaptchaError]
|
[CaptchaError]
|
||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "Captcha 오류."
|
one = "Captcha 오류."
|
||||||
other = "Captcha 오류."
|
other = "Captcha 오류."
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "비밀번호 로그인이 비활성화되었습니다."
|
||||||
|
other = "비밀번호 로그인이 비활성화되었습니다."
|
||||||
|
|||||||
@@ -141,4 +141,9 @@ other = "Требуется капча."
|
|||||||
[CaptchaError]
|
[CaptchaError]
|
||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "Ошибка капчи."
|
one = "Ошибка капчи."
|
||||||
other = "Ошибка капчи."
|
other = "Ошибка капчи."
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "Вход по паролю отключен."
|
||||||
|
other = "Вход по паролю отключен."
|
||||||
@@ -134,4 +134,9 @@ other = "需要验证码。"
|
|||||||
[CaptchaError]
|
[CaptchaError]
|
||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "验证码错误。"
|
one = "验证码错误。"
|
||||||
other = "验证码错误。"
|
other = "验证码错误。"
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "密码登录已禁用。"
|
||||||
|
other = "密码登录已禁用。"
|
||||||
@@ -134,4 +134,9 @@ other = "需要驗證碼。"
|
|||||||
[CaptchaError]
|
[CaptchaError]
|
||||||
description = "Captcha error."
|
description = "Captcha error."
|
||||||
one = "驗證碼錯誤。"
|
one = "驗證碼錯誤。"
|
||||||
other = "驗證碼錯誤。"
|
other = "驗證碼錯誤。"
|
||||||
|
|
||||||
|
[PwdLoginDisabled]
|
||||||
|
description = "Password login disabled."
|
||||||
|
one = "密碼登錄已禁用。"
|
||||||
|
other = "密碼登錄已禁用。"
|
||||||
|
|||||||
Reference in New Issue
Block a user