recoverable

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package recoverable takes care of resetting a user's password and sending reset instructions via email

Index

Constants

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

	FormValueToken = "token"

	EmailRecoverHTML = "mailer/recover.html.tpl"
	EmailRecoverTxt  = "mailer/recover.text.tpl"

	PageRecoverStart  = "recover_start.html.tpl"
	PageRecoverMiddle = "recover_middle.html.tpl"
	PageRecoverEnd    = "recover_end.html.tpl"
)

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