Documentation ¶
Overview ¶
Package confirm implements confirmation of user registration via e-mail
Index ¶
- Constants
- func GenerateToken() (hash string, token string, err error)
- func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler
- type Confirm
- func (c *Confirm) Get(w http.ResponseWriter, r *http.Request) error
- func (c *Confirm) Init(ab *authboss.Authboss) (err error)
- func (c *Confirm) PreventAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error)
- func (c *Confirm) SendConfirmEmail(ctx context.Context, to, token string)
- func (c *Confirm) StartConfirmation(ctx context.Context, user authboss.ConfirmableUser, sendEmail bool) error
- func (c *Confirm) StartConfirmationWeb(w http.ResponseWriter, r *http.Request, handled bool) (bool, error)
Constants ¶
const ( // PageConfirm is only really used for the BodyReader PageConfirm = "confirm" // EmailConfirmHTML is the name of the html template for e-mails EmailConfirmHTML = "confirm_html" // EmailConfirmTxt is the name of the text template for e-mails EmailConfirmTxt = "confirm_txt" // FormValueConfirm is the name of the form value for FormValueConfirm = "cnf" // DataConfirmURL is the name of the e-mail template variable // that gives the url to send to the user for confirmation. DataConfirmURL = "url" )
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
GenerateToken creates a random token that will be used to confirm the user.
func Middleware ¶
Middleware ensures that a user is confirmed, or else it will intercept the request and send them to the confirm page, this will load the user if he's not been loaded yet from the session.
Panics if the user was not able to be loaded in order to allow a panic handler to show a nice error page, also panics if it failed to redirect for whatever reason.
Types ¶
type Confirm ¶
Confirm module
func (*Confirm) Get ¶
Get is a request that confirms a user with a valid token
func (*Confirm) PreventAuth ¶
PreventAuth stops the EventAuth from succeeding when a user is not confirmed This relies on the fact that the context holds the user at this point in time loaded by the auth module (or something else).
func (*Confirm) SendConfirmEmail ¶
SendConfirmEmail sends a confirmation e-mail to a user