Improve welcome page
This commit is contained in:
parent
eb02ba5ba5
commit
266cd2f4d2
2 changed files with 10 additions and 14 deletions
|
|
@ -13,7 +13,7 @@ import (
|
|||
type WelcomeValidation struct {
|
||||
Email string `validate:"required,min=6,max=100,email"`
|
||||
Name string `validate:"required,min=2,max=100"`
|
||||
Password string `validate:"required,min=12,max=100"`
|
||||
Password string `validate:"required,min=10,max=100"`
|
||||
PasswordVerify string `validate:"required,eqfield=Password"`
|
||||
}
|
||||
|
||||
|
|
@ -90,19 +90,14 @@ func WelcomePage(c *fiber.Ctx) error {
|
|||
return c.Redirect(redirectUrl)
|
||||
} else {
|
||||
for _, validErr := range validErrs.(validator.ValidationErrors) {
|
||||
if validErr.Field() == "Email" {
|
||||
switch validErr.Field() {
|
||||
case "Email":
|
||||
formErrors = append(formErrors, "L'adresse email doit être valide.")
|
||||
}
|
||||
|
||||
if validErr.Field() == "Name" {
|
||||
case "Name":
|
||||
formErrors = append(formErrors, "Le nom doit contenir entre 2 et 100 caractères.")
|
||||
}
|
||||
|
||||
if validErr.Field() == "Password" {
|
||||
formErrors = append(formErrors, "Le mot de passe doit contenir entre 12 et 100 caractères.")
|
||||
}
|
||||
|
||||
if validErr.Field() == "PasswordVerify" {
|
||||
case "Password":
|
||||
formErrors = append(formErrors, "Le mot de passe doit contenir entre 10 et 100 caractères.")
|
||||
case "PasswordVerify":
|
||||
formErrors = append(formErrors, "Les mots de passe doivent correspondre.")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ include partials/header.pug
|
|||
.card-header
|
||||
| Paramètres du compte
|
||||
.card-body
|
||||
.alert.alert-danger
|
||||
| !{.FormErrors}
|
||||
if .FormErrors
|
||||
.alert.alert-danger
|
||||
| #{.FormErrors}
|
||||
form#login(method="post")
|
||||
.mb-3
|
||||
label.form-label(for="email") Adresse email
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue