summaryrefslogtreecommitdiff
path: root/system/admin/handlers.go
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2016-10-21 22:29:42 -0700
committerGitHub <noreply@github.com>2016-10-21 22:29:42 -0700
commit737a3f796b87c0ee8236ef949fff81e2238fc071 (patch)
tree79cec6e00e6acbfca5fd5d7c78619fc26d94554c /system/admin/handlers.go
parent519c5b44d0b36e1f61cb0228889401fa1e33357e (diff)
parent936b8aef13b164ce74f9ec11bf1385275d282df8 (diff)
Merge pull request #7 from bosssauce/ponzu-dev
[core] Adding support for automatic TLS / SSL via Let's Encrypt
Diffstat (limited to 'system/admin/handlers.go')
-rw-r--r--system/admin/handlers.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index de340ae..497dec6 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -66,18 +66,20 @@ func initHandler(res http.ResponseWriter, req *http.Request) {
etag := db.NewEtag()
req.Form.Set("etag", etag)
- err = db.SetConfig(req.Form)
+ email := strings.ToLower(req.FormValue("email"))
+ password := req.FormValue("password")
+ usr := user.NewUser(email, password)
+
+ _, err = db.SetUser(usr)
if err != nil {
fmt.Println(err)
res.WriteHeader(http.StatusInternalServerError)
return
}
- email := strings.ToLower(req.FormValue("email"))
- password := req.FormValue("password")
- usr := user.NewUser(email, password)
-
- _, err = db.SetUser(usr)
+ // set initial user email as admin_email and make config
+ req.Form.Set("admin_email", email)
+ err = db.SetConfig(req.Form)
if err != nil {
fmt.Println(err)
res.WriteHeader(http.StatusInternalServerError)