types

package
v0.0.0-...-d05a748 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(t interface{}) error

Validate - validates an object based on it's tags

Types

type TempUser

type TempUser struct {
	FirstName       string `json:"first_name" validate:"required,gte=4"`
	LastName        string `json:"last_name" validate:"required,gte=4"`
	Email           string `json:"email" validate:"required,contains=@"`
	Password        string `json:"-" validate:"required,gte=8"`
	ConfirmPassword string `json:"-" validate:"required,gte=8"`
}

TempUser - the temp user for creating new user

type User

type User struct {
	ID        int64  `json:"id" xorm:"'id' pk autoincr" schema:"id"`
	FirstName string `json:"first_name" xorm:"first_name" schema:"first_name" validate:"required,gte=4"`
	LastName  string `json:"last_name" xorm:"last_name" schema:"last_name" validate:"required,gte=4"`
	Email     string `json:"email" xorm:"email" schema:"email" validate:"required,contains=@"`
	Password  string `json:"-" xorm:"password" schema:"password" validate:"required,gte=8"`
	Visible   bool   `json:"visible" xorm:"visible" schema:"visible"`
}

User - the user in the system

func NewUser

func NewUser(nu *TempUser) (user *User, err error)

NewUser - create new user from a tem user

func (*User) Authenticate

func (u *User) Authenticate(password string) error

Authenticate - authenticates a password agians the stored hash

func (*User) SetPassword

func (u *User) SetPassword(password string) error

SetPassword - use bcrypt to set the password hash

func (*User) TableName

func (u *User) TableName() string

TableName - the table when using xorm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL