mirror of
https://github.com/gabehf/BudgetBuddy.git
synced 2026-03-17 11:16:34 -07:00
updates, added name to schema
This commit is contained in:
parent
272e4e43b1
commit
23463c453c
3 changed files with 1839 additions and 1774 deletions
|
|
@ -26,11 +26,12 @@ func CreateAccount(w http.ResponseWriter, r *http.Request) {
|
|||
var userCollection = db.Client.Database("budgetbuddy").Collection("users")
|
||||
|
||||
// var v contains POST credentials
|
||||
var v Credentials
|
||||
var v UserSchema
|
||||
r.ParseForm()
|
||||
v.Email = r.FormValue("email")
|
||||
v.Password = r.FormValue("password")
|
||||
if v.Email == "" || v.Password == "" {
|
||||
v.Name = r.FormValue("name")
|
||||
if v.Email == "" || v.Password == "" || v.Name == "" {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
@ -79,6 +80,7 @@ func CreateAccount(w http.ResponseWriter, r *http.Request) {
|
|||
// return the account information to the user
|
||||
ret, err := json.Marshal(LoginResponse{
|
||||
Email: v.Email,
|
||||
Name: v.Name,
|
||||
Session: v.Session,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue