@@ -70,7 +70,10 @@ type User struct {
7070 CreatedAt time.Time `json:"created_at" bson:"created_at"`
7171 LastLogin time.Time `json:"last_login" bson:"last_login"`
7272 EmailMarketing bool `json:"email_marketing" bson:"email_marketing"`
73- UserData `bson:",inline"`
73+
74+ Name string `json:"name" validate:"required,name"`
75+ Username string `json:"username" bson:"username" validate:"required,username"`
76+ Email string `json:"email" bson:"email" validate:"required,email"`
7477
7578 // PasswordDigest stores the hashed password.
7679 PasswordDigest string `json:"-"`
@@ -83,17 +86,6 @@ type User struct {
8386 Preferences UserPreferences `json:"preferences" bson:"preferences"`
8487}
8588
86- type UserData struct {
87- Name string `json:"name" validate:"required,name"`
88- Username string `json:"username" bson:"username" validate:"required,username"`
89- Email string `json:"email" bson:"email" validate:"required,email"`
90- // RecoveryEmail is a custom, non-unique email address that a user can use to recover their account
91- // when they lose access to all other methods. It must never be equal to [UserData.Email].
92- //
93- // NOTE: Recovery email is available as a cloud-only feature and must be ignored in community.
94- RecoveryEmail string `json:"recovery_email" bson:"recovery_email" validate:"omitempty,email"`
95- }
96-
9789// UserMFA represents the attributes related to MFA for a user.
9890type UserMFA struct {
9991 // Enabled reports whether MFA is enabled for the user.
@@ -110,6 +102,12 @@ type UserPreferences struct {
110102
111103 // AuthMethods indicates the authentication methods that the user can use to authenticate.
112104 AuthMethods []UserAuthMethod `json:"auth_methods" bson:"auth_methods"`
105+
106+ // RecoveryEmail is a custom, non-unique email address that a user can use to recover their account
107+ // when they lose access to all other methods. It must never be equal to [UserData.Email].
108+ //
109+ // NOTE: Recovery email is available as a cloud-only feature and must be ignored in community.
110+ RecoveryEmail string `json:"recovery_email" bson:"recovery_email" validate:"omitempty,email"`
113111}
114112
115113// UserAuthIdentifier is an username or email used to authenticate.
0 commit comments