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