Add apps page

This commit is contained in:
2021-01-12 14:07:55 +01:00
parent 4dd819d49f
commit ad03e0758b
13 changed files with 298 additions and 79 deletions

View File

@@ -148,8 +148,10 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) {
}
if f.ReadInput(r) {
loginResp, err := td.PixelAPI.UserLogin(f.FieldVal("username"), f.FieldVal("password"))
if err != nil {
if session, err := td.PixelAPI.UserLogin(
f.FieldVal("username"),
f.FieldVal("password"),
); err != nil {
formAPIError(err, &f)
} else {
// Request was a success
@@ -159,7 +161,7 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) {
// Set the autentication cookie
f.Extra.SetCookie = &http.Cookie{
Name: "pd_auth_key",
Value: loginResp.APIKey,
Value: session.AuthKey.String(),
Path: "/",
Expires: time.Now().AddDate(50, 0, 0),
Domain: wc.sessionCookieDomain,