Documentation
¶
Overview ¶
Package accounts creates user accounts and the first administrator.
Index ¶
- Constants
- Variables
- func BootstrapAdmin(username, email, password string) (created bool, err error)
- func Build(username, email, password string, role *models.UserRole) (*models.User, error)
- func CreateAdmin(username, email, password string) (*models.User, error)
- func SetPassword(username, password string) error
Constants ¶
const MinAdminPasswordLength = 12
MinAdminPasswordLength applies to administrators created from the configuration or the command line.
Variables ¶
var ErrInvalid = errors.New("invalid account")
ErrInvalid matches validation errors (bad username, email or password) with errors.Is.
Functions ¶
func BootstrapAdmin ¶
BootstrapAdmin creates the configured administrator when the instance has no users yet. It does nothing when username is empty or users exist, so it is safe to run at every start and from several replicas (a concurrent creation fails on the unique username and is ignored).
func Build ¶
Build validates a new account and hashes its password. Validation errors wrap ErrInvalid.
func CreateAdmin ¶
CreateAdmin creates an account with the admin role.
func SetPassword ¶
SetPassword replaces a user's password.
Types ¶
This section is empty.