model

package
v0.0.0-...-af1923c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UserLoginSessionKey = "userLogin"

UserLoginSessionKey session key for user login

Variables

This section is empty.

Functions

This section is empty.

Types

type Preferences

type Preferences struct {
	SendSecurityAlerts bool
	SendNewsLetter     bool
	Enable2fa          bool
}

Preferences of website users

type User

type User struct {
	Login       string
	Firstname   string
	Lastname    string
	Email       string
	PhoneNumber string

	Password string
	Salt     string
	Version  int8

	LastLogin     int32
	LoginFailures int8
	LastLoginFail int32

	Status UserStatus

	Preferences
}

User users of the website

func NewUser

func NewUser(login, firstname, lastname, email, phonenumber, password string,
	sendSecurityAlerts, sendNewsLetter, enable2fa bool) (user User, err error)

NewUser creates new user

func (*User) Authenticate

func (u *User) Authenticate(plaintextPassword string) (bool, error)

Authenticate checks user password

func (*User) SetPassword

func (u *User) SetPassword(plaintextPassword string) (err error)

SetPassword sets user password

type UserStatus

type UserStatus int8

UserStatus account status

const (
	UserUnverified UserStatus = iota
	UserPasswordReset
	UserActive
	UserSuspended
	UserDisabled
	UserDeleted
)

User account status

Jump to

Keyboard shortcuts

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