model

package
v0.0.0-...-a69ed84 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyPassword = errors.New("empty password")

ErrEmptyPassword is returned if user supplied an empty password.

Functions

This section is empty.

Types

type User

type User struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	Password string `json:",omitempty"`
}

User model.

func NewUser

func NewUser(email, password string) (*User, error)

NewUser creates new user model.

func (*User) HashPassword

func (u *User) HashPassword() error

HashPassword hashes password.

func (*User) IsValidPassword

func (u *User) IsValidPassword(plainPassword string) bool

IsValidPassword returns true if provided plain password matches stored hash.

Jump to

Keyboard shortcuts

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