Help us shape the future of Go! Take the 2026 Go Developer Survey

recover

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 13 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 deprecated

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

Deprecated: Use authboss.OneTimeTokenGenerator instead.

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 []string, 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