recover

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package recover implements password reset via e-mail.

Index

Constants

View Source
const (
	DataRecoverToken = "recover_token"
	DataRecoverURL   = "recover_url"

	FormValueToken = "token"

	EmailRecoverHTML = "recover_html"
	EmailRecoverTxt  = "recover_txt"

	PageRecoverStart  = "recover_start"
	PageRecoverMiddle = "recover_middle"
	PageRecoverEnd    = "recover_end"
)

Constants for templates etc.

Variables

This section is empty.

Functions

func GenerateRecoverCreds

func GenerateRecoverCreds() (selector, verifier, token string, err error)

GenerateRecoverCreds generates pieces needed for user recovery selector: hash of the first half of a 64 byte value (to be stored in the database and used in SELECT query) verifier: hash of the second half of a 64 byte value (to be stored in database but never used in SELECT query) token: the user-facing base64 encoded selector+verifier

Types

type Recover

type Recover struct {
	*authboss.Authboss
}

Recover module

func (*Recover) EndGet

func (r *Recover) EndGet(w http.ResponseWriter, req *http.Request) error

EndGet shows a password recovery form, and it should have the token that the user brought in the query parameters in it on submission.

func (*Recover) EndPost

func (r *Recover) EndPost(w http.ResponseWriter, req *http.Request) error

EndPost retrieves the token

func (*Recover) Init

func (r *Recover) Init(ab *authboss.Authboss) (err error)

Init module

func (*Recover) SendRecoverEmail

func (r *Recover) SendRecoverEmail(ctx context.Context, to, encodedToken string)

SendRecoverEmail to a specific e-mail address passing along the encodedToken in an escaped URL to the templates.

func (*Recover) StartGet

func (r *Recover) StartGet(w http.ResponseWriter, req *http.Request) error

StartGet starts the recover procedure by rendering a form for the user.

func (*Recover) StartPost

func (r *Recover) StartPost(w http.ResponseWriter, req *http.Request) error

StartPost starts the recover procedure using values provided from the user usually from the StartGet's form.

Jump to

Keyboard shortcuts

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