mirror of
https://github.com/gabehf/BudgetBuddy.git
synced 2026-03-17 03:06:40 -07:00
new endpoints, budget adjustment
This commit is contained in:
parent
cc36b80e72
commit
c4047a36cc
9 changed files with 276 additions and 20 deletions
|
|
@ -34,12 +34,17 @@ func CreateAccount(w http.ResponseWriter, r *http.Request) {
|
|||
v.Name = r.FormValue("name")
|
||||
if v.Email == "" || v.Password == "" || v.Name == "" {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprint(w, "{\"error\":\"field(s) are missing\"}")
|
||||
return
|
||||
}
|
||||
|
||||
if len(v.Password) < 8 || len(v.Password) > 255 || !EmailIsValid(v.Email) {
|
||||
if len(v.Password) < 8 || len(v.Password) > 255 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprint(w, "{\"error\":\"there was a problem with your request. Please try again with different values\"}")
|
||||
fmt.Fprint(w, "{\"error\":\"password must be 8 characters or greater\"}")
|
||||
return
|
||||
} else if !EmailIsValid(v.Email) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprint(w, "{\"error\":\"email is invalid\"}")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue