Documentation
¶
Index ¶
Constants ¶
View Source
const ( SUPERADMIN = "SuperAdmin" ADMIN = "Admin" USER = "User" // Regular expression for matching email addresses EMAILREGEX = `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` )
Variables ¶
This section is empty.
Functions ¶
func AuthRoutes ¶
Types ¶
type EmailSender ¶
email verifications sender email and password
type JwtCustomClaims ¶
type JwtCustomClaims struct {
UserID string `json:"userId"`
Role string `json:"role"`
IsActive bool `json:"isActive"`
jwt.RegisteredClaims
}
type User ¶
type User struct {
ID string `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Email string `gorm:"not null;index;unique" json:"email" form:"email"`
Password string `gorm:"not null" json:"-" form:"password"`
Role string `gorm:"not null" json:"role" form:"role"`
IsActive bool `gorm:"not null;default:true" json:"isActive" form:"isActive"`
}
user model in database
func (*User) HashPassword ¶
HashPassword securely hashes the provided password and sets it in the Password field.
type UserCreate ¶
type UserCreate struct {
Email string `json:"email" form:"email" validate:"required"`
Password string `json:"password" form:"password" validate:"required"`
}
func (*UserCreate) Serialize ¶
func (u *UserCreate) Serialize() *User
serializes user creations from UserCreate form to insert to database
Click to show internal directories.
Click to hide internal directories.