selfservice

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 29 Imported by: 0 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

Overview

Package selfservice implements the public self-service account pages: forgotten-password reset for agents and customers, and customer self-registration with email verification.

Both flows are switched by config/default.yaml: features.lost_password (agent + customer password reset) and features.registration (customer sign-up). Links in emails are built from BASE_URL, the operator-set public URL of the instance; the request Host header is never trusted for that.

Index

Constants

View Source
const (
	TokenPasswordReset = "password_reset"
	TokenEmailVerify   = "email_verify"
)

Token types stored in gk_auth_token.token_type.

View Source
const (
	UserAgent    = "agent"
	UserCustomer = "customer"
)

Account types stored in gk_auth_token.user_type.

View Source
const (
	StatusPending  = "pending"
	StatusApproved = "approved"
)

Registration request statuses (gk_registration_request.status).

View Source
const (
	// ResetTokenTTL is how long a password reset link stays valid.
	ResetTokenTTL = 1 * time.Hour
	// VerifyTokenTTL is how long a registration confirmation link stays valid.
	VerifyTokenTTL = 24 * time.Hour
)

Token lifetimes and request budgets.

View Source
const EnvBaseURL = "BASE_URL"

EnvBaseURL names the environment variable holding the public URL of this instance (scheme://host[:port][/prefix]). Links in self-service emails are built from it; the request Host header is attacker-controlled and would let anyone send a victim a reset link pointing at their own server.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.10.0

type Account struct {
	Type      string
	ID        int
	Login     string
	Email     string
	FirstName string
	LastName  string
}

Account is an agent (users) or customer (customer_user) that can receive a reset link. Email is where the link goes; the token is bound to it.

Jump to

Keyboard shortcuts

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