Validating the password and repeated password on register page
This commit is contained in:
parent
96e884f0a2
commit
ff747d7cc2
|
@ -33,9 +33,18 @@ func (h Handlers) RegisterPost(c *fiber.Ctx) error {
|
||||||
|
|
||||||
err := c.BodyParser(newUser)
|
err := c.BodyParser(newUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.Log.Debug("Invalid input data", "err", err.Error())
|
h.Log.Debug("Invalid input data, BodyParser() failed", "err", err.Error())
|
||||||
c.Status(400)
|
c.Status(400)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if newUser.Password != newUser.RepeatPassword {
|
||||||
|
h.Log.Debug("Password and RepeatPassword does not match")
|
||||||
|
c.Status(400)
|
||||||
|
return c.Status(400).SendString(views.Register(views.RegisterData{
|
||||||
|
ErrMsg: "Password and repeated password does not match!",
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
newUser.Name = newUser.Username
|
newUser.Name = newUser.Username
|
||||||
newUser.Fields = append(newUser.Fields, field{
|
newUser.Fields = append(newUser.Fields, field{
|
||||||
Name: "role",
|
Name: "role",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user