This commit is contained in:
Nazar Kanaev
2021-02-12 10:31:00 +00:00
parent e8a002d535
commit 6a828532cb
4 changed files with 23 additions and 0 deletions

View File

@@ -39,6 +39,15 @@ func userAuthenticate(rw http.ResponseWriter, username, password string) {
http.SetCookie(rw, &cookie)
}
func userLogout(rw http.ResponseWriter) {
cookie := http.Cookie{
Name: "auth",
Value: "",
MaxAge: -1,
}
http.SetCookie(rw, &cookie)
}
func stringsEqual(p1, p2 string) bool {
return subtle.ConstantTimeCompare([]byte(p1), []byte(p2)) == 1
}