password

package
v0.0.0-...-03ec3e3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectPassword = echo.NewHTTPError(http.StatusBadRequest, "incorrect old password")
	ErrInsecurePassword  = echo.NewHTTPError(http.StatusBadRequest, "insecure password")
)

Custom errors

Functions

This section is empty.

Types

type Password

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

Password represents password application service

func Initialize

func Initialize(db *pg.DB, rbac RBAC, sec Securer) *Password

Initialize initalizes password application service with defaults

func New

func New(db *pg.DB, udb UserDB, rbac RBAC, sec Securer) *Password

New creates new password application service

func (*Password) Change

func (p *Password) Change(c echo.Context, userID int, oldPass, newPass string) error

Change changes user's password

type RBAC

type RBAC interface {
	EnforceUser(echo.Context, int) error
}

RBAC represents role-based-access-control interface

type Securer

type Securer interface {
	Hash(string) string
	HashMatchesPassword(string, string) bool
	Password(string, ...string) bool
}

Securer represents security interface

type Service

type Service interface {
	Change(echo.Context, int, string, string) error
}

Service represents password application interface

type UserDB

type UserDB interface {
	View(orm.DB, int) (*gorsk.User, error)
	Update(orm.DB, *gorsk.User) error
}

UserDB represents user repository interface

Directories

Path Synopsis
platform

Jump to

Keyboard shortcuts

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