models

package
v0.0.0-...-0f93876 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdminHmac = util.GenerateHmac(64)
View Source
var UserHmac = util.GenerateHmac(64)

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Auth
	Email string `gorm:"unique" sql:"index"`
}

func (*Admin) ByEmail

func (a *Admin) ByEmail(email string) error

func (*Admin) GetJwt

func (a *Admin) GetJwt() (string, int)

type Auth

type Auth struct {
	Base
	PasswordHash      string `json:"-"`
	TwoFactorSecret   string `json:"-"`
	TwoFactorRecovery string `json:"-"`
	Verified          bool   `json:"-"`
}

func (*Auth) CheckPassword

func (a *Auth) CheckPassword(pass string) error

func (*Auth) GenerateNewTwoFactorSecret

func (a *Auth) GenerateNewTwoFactorSecret()

func (*Auth) Login

func (a *Auth) Login(pass string, tfCode string) (error, bool)

func (*Auth) SetPassword

func (a *Auth) SetPassword(pass string) error

func (*Auth) ValidateTwoFactor

func (a *Auth) ValidateTwoFactor(tfCode string, stamp time.Time) error

type Base

type Base struct {
	Uid     uuid.UUID `gorm:"type:uuid;primary_key;<-:create"`
	Created time.Time `gorm:"<-:create"`
	Updated time.Time
	Deleted time.Time `gorm:"index"`
}

func (*Base) BeforeCreate

func (b *Base) BeforeCreate(scope *gorm.DB) error

func (*Base) BeforeSave

func (b *Base) BeforeSave(scope *gorm.DB) error

func (*Base) Delete

func (b *Base) Delete()

type Tenanted

type Tenanted struct {
	Base
	Tenant uuid.UUID `gorm:"index;<-:create"`
}

func (*Tenanted) BeforeCreate

func (t *Tenanted) BeforeCreate(scope *gorm.DB) error

type TotpUsage

type TotpUsage struct {
	LoginUid uuid.UUID `gorm:"index"`
	Used     time.Time
	Code     string `gorm:"index"`
}

type User

type User struct {
	Auth
	Email string `gorm:"unique;index"`
}

func (*User) ByEmail

func (u *User) ByEmail(email string) error

func (*User) Create

func (u *User) Create() error

func (*User) GetJwt

func (u *User) GetJwt() (string, int)

func (*User) GetResetPasswordJwt

func (u *User) GetResetPasswordJwt() string

func (*User) GetVerificationJwt

func (u *User) GetVerificationJwt() string

func (*User) Save

func (u *User) Save() error

Jump to

Keyboard shortcuts

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