Also, handle first user differently under the hood
This commit is contained in:
@ -236,12 +236,18 @@ func AddFirstUser(c *control.CliArgs, db *model.DB, s *control.CookieStore) http
|
||||
return
|
||||
}
|
||||
|
||||
htmlData.ID, err = db.AddUser(htmlData.User, pass)
|
||||
htmlData.ID, err = db.AddFirstUser(htmlData.User, pass)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if htmlData.ID > 1 {
|
||||
errString := "error: there is already a first user"
|
||||
log.Println(errString)
|
||||
http.Error(w, errString, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
if err := saveSession(w, r, s, htmlData.User); err != nil {
|
||||
log.Println(err)
|
||||
|
Reference in New Issue
Block a user