registration

This commit is contained in:
Bel LaPointe
2020-07-24 15:06:49 -06:00
parent d3ac4f5c22
commit 3a69fad9f7
4 changed files with 163 additions and 15 deletions

View File

@@ -9,7 +9,6 @@ import (
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"time"
@@ -114,23 +113,11 @@ func TestAuth(t *testing.T) {
if w.Code != http.StatusSeeOther {
t.Fatalf("%d: %s", w.Code, w.Body.Bytes())
}
cookies := w.Header()["Set-Cookie"]
if len(cookies) == 0 {
t.Fatal(w.Header())
}
var rawtoken string
for i := range cookies {
value := strings.Split(cookies[i], ";")[0]
key := value[:strings.Index(value, "=")]
value = value[strings.Index(value, "=")+1:]
if key == NewAuthKey {
rawtoken = value
}
}
rawtoken := getCookie(NewAuthKey, w.Header())
if rawtoken == "" {
t.Fatal(w.Header())
}
token, err := aesDec("password", rawtoken)
if err != nil {
t.Fatal(err)