allow user to change their password

This commit is contained in:
2023-02-09 01:07:31 -03:00
parent 63392e2726
commit 73e958efb1
4 changed files with 49 additions and 9 deletions

View File

@@ -7,11 +7,12 @@ import (
type User struct {
gorm.Model
ID uint64 `json:"ID" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Username string `json:"username" gorm:"unique; not null"`
Email string `json:"email" gorm:"unique;not null"`
Password string `json:"password" gorm:"not null"`
ID uint64 `json:"ID" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Username string `json:"username" gorm:"unique; not null"`
Email string `json:"email" gorm:"unique;not null"`
Password string `json:"password,omitempty" gorm:"not null"`
NewPassword string `json:"new_password,omitempty" gorm:"-:all"`
}
func (user *User) HashPassword(password string) error {