hmac-based auth

This commit is contained in:
Nazar Kanaev
2021-01-04 14:03:51 +00:00
parent edc7d56219
commit 9fcaad6b2f
2 changed files with 22 additions and 8 deletions

View File

@@ -95,7 +95,7 @@ func IndexHandler(rw http.ResponseWriter, req *http.Request) {
if req.Method == "POST" {
username := req.FormValue("username")
password := req.FormValue("password")
if safeCompare(username, h.Username) && safeCompare(password, h.Password) {
if stringsEqual(username, h.Username) && stringsEqual(password, h.Password) {
userAuthenticate(rw, username, password)
http.Redirect(rw, req, req.URL.Path, http.StatusFound)
return