authmodel

package
v0.0.0-...-d64eb31 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPinAlreadyExists = errors.New("pin already exists")
	ErrInvalidPin       = errors.New("invalid pin")
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	core.BaseModel
	UserId     int    `json:"userId" gorm:"column:user_id;" db:"user_id"`
	AuthType   string `json:"authType" gorm:"column:auth_type;" db:"auth_type"`
	Email      string `json:"email" gorm:"column:email;" db:"email"`
	Salt       string `json:"salt" gorm:"column:salt;" db:"salt"`
	Password   string `json:"password" gorm:"column:password;" db:"password"`
	FacebookId string `json:"facebookId" gorm:"column:facebook_id" db:"facebook_id"`
}

func NewAuthWithEmailPassword

func NewAuthWithEmailPassword(userId int, email, salt, password string) Auth

func (Auth) TableName

func (Auth) TableName() string

type AuthEmailPassword

type AuthEmailPassword struct {
	Email    string `json:"email" form:"email" validate:"required,email"`
	Password string `json:"password" form:"password" validate:"required,min=8"`
}

type AuthRegister

type AuthRegister struct {
	FirstName string `json:"firstName" form:"firstName" validate:"required,alpha"`
	LastName  string `json:"lastName" form:"lastName" validate:"required,alpha"`
	AuthEmailPassword
}

type Token

type Token struct {
	Token string `json:"token"`
	// ExpiredIn in seconds
	ExpiredIn int `json:"expiredIn"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken Token `json:"accessToken"`
	// RefreshToken will be used when access token expired
	// to issue new pair access token and refresh token.
	RefreshToken *Token `json:"refreshToken,omitempty"`
}

Jump to

Keyboard shortcuts

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