Merge 51365d066c9eb2955e2e974bb2028242b1089b97 into 88abb323cb8e596e8053ce57f890dcc7286fe012

This commit is contained in:
NekoGirlSAIKOU 2025-04-12 20:25:10 +08:00 committed by GitHub
commit 8fbc8fd37e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -60,6 +60,10 @@ func (u *User) IsAdmin() bool {
return u.Role == ADMIN
}
func (u *User) IsOtpEnabled() bool {
return u.OtpSecret != ""
}
func (u *User) ValidateRawPassword(password string) error {
return u.ValidatePwdStaticHash(StaticHash(password))
}

View File

@ -82,7 +82,7 @@ func WebDAVAuth(c *gin.Context) {
return
}
user, err := op.GetUserByName(username)
if err != nil || user.ValidateRawPassword(password) != nil {
if err != nil || user.IsOtpEnabled() || user.ValidateRawPassword(password) != nil {
if c.Request.Method == "OPTIONS" {
c.Set("user", guest)
c.Next()