password

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: BSD-3-Clause Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPassword is returned when an invalid password is passed
	ErrInvalidPassword = errors.New("Invalid password")
)

Functions

func Check added in v1.0.0

func Check(password string) error

Check to see if a password is valid for a user.

func InitModels

func InitModels()

InitModels initializes models in mongo, if required.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager stores and validates passwords

func NewManager

func NewManager(r *http.Request) *Manager

NewManager creates a new Manager

func (*Manager) DeleteResetToken

func (pwm *Manager) DeleteResetToken(token string) (err error)

DeleteResetToken delete reset token by token

func (*Manager) FindResetToken

func (pwm *Manager) FindResetToken(token string) (tokenobj *ResetToken, err error)

FindResetToken find reset token by token

func (*Manager) NewResetToken

func (pwm *Manager) NewResetToken(username string) (token *ResetToken, err error)

NewResetToken get new reset token

func (*Manager) Save

func (pwm *Manager) Save(username, password string) error

Save stores a password for a specific username.

func (*Manager) SaveResetToken

func (pwm *Manager) SaveResetToken(token *ResetToken) (err error)

SaveResetToken save reset token

func (*Manager) Validate

func (pwm *Manager) Validate(username, password string) (bool, error)

Validate checks the password for a specific username

type ResetToken

type ResetToken struct {
	Username  string
	Token     string
	CreatedAt time.Time
}

Directories

Path Synopsis
crypt
Package crypt provides interface for password crypt functions and collects common constants.
Package crypt provides interface for password crypt functions and collects common constants.
crypt/sha512crypt
Package sha512crypt implements Ulrich Drepper's SHA512-crypt password hashing algorithm.
Package sha512crypt implements Ulrich Drepper's SHA512-crypt password hashing algorithm.

Jump to

Keyboard shortcuts

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