pull/7097/merge
NekoGirlSAIKOU 2025-09-20 00:44:14 +05:30 committed by GitHub
commit 632bc08219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -95,7 +95,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()