register, login logic works
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
@@ -30,6 +31,14 @@ func RegisterHandler(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
if _, err := AddNewUser(ctx, User{0, username, password, "xxx", false}); err != nil {
|
||||
http.Error(response, "Internal server error", http.StatusInternalServerError)
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
|
||||
response.WriteHeader(http.StatusCreated)
|
||||
_, err := response.Write([]byte("registered"))
|
||||
if err != nil {
|
||||
http.Error(response, "Internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user