registration
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user