models

package
v0.0.0-...-c96426c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(login, password string) (map[string]interface{}, error)

func ResetPassword

func ResetPassword(otp, password []byte) (map[string]interface{}, error)

func VerifyAccount

func VerifyAccount(otp []byte) (map[string]interface{}, error)

Types

type Account

type Account struct {
	gorm.Model
	Email                    string    `json:"email,omitempty"`
	Password                 string    `json:"password"`
	Token                    string    `json:"token" gorm:"-:all"`
	Phone                    string    `json:"phone,omitempty"`
	Username                 string    `json:"username"`
	Verified                 bool      `json:"verified"`
	VerificationOTP          string    `json:"-"`
	RestorePasswordOTP       string    `json:"-"`
	TimeVerificationOTPSet   time.Time `json:"-"`
	TimeForgotPasswordOTPSet time.Time `json:"-"`
}

func GetUser

func GetUser(u uint) *Account

func (*Account) ChangePassword

func (a *Account) ChangePassword(password []byte) (map[string]interface{}, error)

func (*Account) Create

func (a *Account) Create() (map[string]interface{}, error)

func (*Account) SendEmailOTP

func (a *Account) SendEmailOTP(email string, isVerification bool, host string) (map[string]interface{}, error)

func (*Account) Validate

func (a *Account) Validate() (msg map[string]interface{}, ok bool)

type Token

type Token struct {
	UserID   uint
	Verified bool
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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