fix(05): CR-03 hide User password and require secret columns in Hidden()
This commit is contained in:
@@ -4,12 +4,15 @@ package models
|
|||||||
type User struct {
|
type User struct {
|
||||||
ID uint `gorm:"column:id;primaryKey"`
|
ID uint `gorm:"column:id;primaryKey"`
|
||||||
Email string `gorm:"column:email"`
|
Email string `gorm:"column:email"`
|
||||||
Password string `gorm:"column:password"`
|
Password string `gorm:"column:password" json:"-"`
|
||||||
MustChangePassword bool `gorm:"column:must_change_password"`
|
MustChangePassword bool `gorm:"column:must_change_password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (User) TableName() string { return "users" }
|
func (User) TableName() string { return "users" }
|
||||||
|
|
||||||
|
// Hidden mirrors PHP User::$hidden for the columns this stub carries (D-08).
|
||||||
|
func (User) Hidden() []string { return []string{"password"} }
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Register(User{})
|
Register(User{})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user