mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Fixed non-byte value in hashing function
Also fixed some other misc. build errors, & added err catch to exec result.
This commit is contained in:
parent
ba9c7c7a5d
commit
7491d1c86e
|
@ -41,7 +41,7 @@ func AddUser() common.Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := r.ParseMultipartForm(32 << 20)
|
err = r.ParseMultipartForm(32 << 20)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &common.HTTPError{
|
return &common.HTTPError{
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
|
@ -54,9 +54,15 @@ func AddUser() common.Handler {
|
||||||
realname := strings.Join(r.Form["realname"], "")
|
realname := strings.Join(r.Form["realname"], "")
|
||||||
email := strings.Join(r.Form["email"], "")
|
email := strings.Join(r.Form["email"], "")
|
||||||
|
|
||||||
hash, err := bcrypt.GenerateFromPassword(password, 4)
|
hash, err := bcrypt.GenerateFromPassword([]byte(password), 4)
|
||||||
|
|
||||||
result, err := statement.Exec(username,hash,realname,email)
|
_, err = statement.Exec(username,hash,realname,email)
|
||||||
|
if err != nil {
|
||||||
|
return &common.HTTPError{
|
||||||
|
Message: fmt.Sprintf("error executing sqlite3 statement: %v", err),
|
||||||
|
StatusCode: http.StatusInternalServerError,
|
||||||
|
}
|
||||||
|
}
|
||||||
w.Write([]byte("<script>window.location = '/admin#/users/added';</script>"))
|
w.Write([]byte("<script>window.location = '/admin#/users/added';</script>"))
|
||||||
db.Close()
|
db.Close()
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue