users

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 13 Imported by: ? 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 users is the accounts of the multi mode: the sign-up, and the routes an admin runs the others with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(db bun.IDB) http.HandlerFunc

Delete deletes an account for good, with all its data: DELETE /api/users/{id}. @Summary Delete an account and all its data @Tags users @Param id path string true "Account id" @Success 204 @Failure 400 {object} respond.Failure @Failure 401 {object} respond.Failure @Failure 403 {object} respond.Failure @Failure 404 {object} respond.Failure @Router /api/users/{id} [delete]

func List

func List(db bun.IDB) http.HandlerFunc

List gives every account, by name: GET /api/users. @Summary List the accounts @Tags users @Produce json @Success 200 {array} domain.User @Failure 401 {object} respond.Failure @Failure 403 {object} respond.Failure @Failure 404 {object} respond.Failure @Router /api/users [get]

func Modes

func Modes(mode domain.ServerMode) http.HandlerFunc

Modes tells the login and sign-up pages how the server runs, without a session: GET /api/add-user. @Summary How the server runs: its mode and how accounts are created @Tags users @Produce json @Success 200 {object} domain.ServerMode @Router /api/add-user [get]

func ResetPassword

func ResetPassword(db bun.IDB) http.HandlerFunc

ResetPassword gives an account a random password, in the answer only, and logs its sessions out: POST /api/users/{id}/password. @Summary Reset the password of an account @Tags users @Produce json @Param id path string true "Account id" @Success 200 {object} users.Reset @Failure 401 {object} respond.Failure @Failure 403 {object} respond.Failure @Failure 404 {object} respond.Failure @Router /api/users/{id}/password [post]

func Signup

func Signup(db bun.IDB, mode domain.ServerMode) http.HandlerFunc

Signup creates an account and logs it in, without a session: POST /api/signup, in the multi mode only. It needs an invitation in the invitation mode, but for the first account of a base, which becomes admin. Its tries count with the wrong passwords of the address (throttle.Passwords): an invitation cannot be guessed either. In the public mode the accounts of an address count too (throttle.Signups): a few, then it waits longer at each one. @Summary Create an account and log it in @Tags users @Accept json @Produce json @Param body body createuser.Input true "body" @Success 200 {object} createsession.Result @Failure 400 {object} respond.Failure @Failure 403 {object} respond.Failure @Failure 404 {object} respond.Failure @Failure 429 {object} respond.Failure @Router /api/signup [post]

Types

type Reset

type Reset struct {
	Password string `json:"password"`
}

Reset is the new password of an account: it goes to the admin once, the base keeping only its hash.

Jump to

Keyboard shortcuts

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