mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-24 20:21:54 +08:00
feat: allow no auth
License: MIT Signed-off-by: Henrique Dias <[email protected]>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package webdav
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func checkPassword(saved, input string) bool {
|
||||
if strings.HasPrefix(saved, "{bcrypt}") {
|
||||
savedPassword := strings.TrimPrefix(saved, "{bcrypt}")
|
||||
return bcrypt.CompareHashAndPassword([]byte(savedPassword), []byte(input)) == nil
|
||||
}
|
||||
|
||||
return saved == input
|
||||
}
|
||||
Reference in New Issue
Block a user