Merge pull request 'fix: use ValidateEmail as binding across web forms' (#5158) from solomonv/consolidate-email-validation into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5158
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Gusted 2024-10-21 14:31:32 +00:00
commit f298bf125a
24 changed files with 281 additions and 221 deletions

View file

@ -15,7 +15,7 @@ type CreateUserOption struct {
FullName string `json:"full_name" binding:"MaxSize(100)"`
// required: true
// swagger:strfmt email
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
Email string `json:"email" binding:"Required;EmailForAdmin;MaxSize(254)"`
Password string `json:"password" binding:"MaxSize(255)"`
MustChangePassword *bool `json:"must_change_password"`
SendNotify bool `json:"send_notify"`

View file

@ -7,7 +7,7 @@ package structs
// Email an email address belonging to a user
type Email struct {
// swagger:strfmt email
Email string `json:"email"`
Email string `json:"email" binding:"EmailWithAllowedDomain"`
Verified bool `json:"verified"`
Primary bool `json:"primary"`
UserID int64 `json:"user_id"`