Handle user creation upon registration.
This commit is contained in:
parent
79d2db3c1f
commit
8657380530
13 changed files with 201 additions and 46 deletions
|
|
@ -14,6 +14,14 @@ import (
|
|||
func init() {
|
||||
userFields := schema.User{}.Fields()
|
||||
_ = userFields
|
||||
// userDescUsername is the schema descriptor for username field.
|
||||
userDescUsername := userFields[0].Descriptor()
|
||||
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||
user.UsernameValidator = userDescUsername.Validators[0].(func(string) error)
|
||||
// userDescPassword is the schema descriptor for password field.
|
||||
userDescPassword := userFields[1].Descriptor()
|
||||
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
||||
user.PasswordValidator = userDescPassword.Validators[0].(func(string) error)
|
||||
// userDescCreatedAt is the schema descriptor for created_at field.
|
||||
userDescCreatedAt := userFields[2].Descriptor()
|
||||
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue