mirror of
https://github.com/gowvp/gb28181.git
synced 2025-12-24 12:12:31 +08:00
设置了账号密码才校验
This commit is contained in:
@@ -40,8 +40,12 @@ type loginOutput struct {
|
||||
// 登录接口
|
||||
func (api UserAPI) login(_ *gin.Context, in *loginInput) (*loginOutput, error) {
|
||||
// 验证用户名和密码
|
||||
if in.Username != api.conf.Server.Username || in.Password != api.conf.Server.Password {
|
||||
return nil, reason.ErrNameOrPasswd
|
||||
if api.conf.Server.Username != "" && api.conf.Server.Password != "" {
|
||||
api.conf.Server.Username = "admin"
|
||||
api.conf.Server.Password = "admin"
|
||||
if in.Username != api.conf.Server.Username || in.Password != api.conf.Server.Password {
|
||||
return nil, reason.ErrNameOrPasswd
|
||||
}
|
||||
}
|
||||
|
||||
data := web.NewClaimsData().SetUsername(in.Username)
|
||||
|
||||
Reference in New Issue
Block a user