fix(BREAKING): rename webdav/ --> lib/ (#36)

License: MIT
Signed-off-by: Henrique Dias <[email protected]>
This commit is contained in:
Henrique Dias
2019-11-10 11:30:45 +00:00
committed by GitHub
parent 3ef86e8a7f
commit 72d8e39927
7 changed files with 32 additions and 30 deletions
Executable
+25
View File
@@ -0,0 +1,25 @@
package lib
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
}
func isAllowedHost(allowedHosts []string, origin string) bool {
for _, host := range allowedHosts {
if host == origin {
return true
}
}
return false
}