webaccount

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 36 Imported by: 2

Documentation

Overview

Package webaccount provides a web app for users to view and change their account settings, and to import/export email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAuth

func CheckAuth(ctx context.Context, log *mlog.Log, kind string, w http.ResponseWriter, r *http.Request) (address, account string)

CheckAuth checks http basic auth, returns login address and account name if valid, and writes http response and returns empty string otherwise.

func Handle

func Handle(w http.ResponseWriter, r *http.Request)

func ImportManage

func ImportManage()

ImportManage should be run as a goroutine, it manages imports of mboxes/maildirs, propagating progress over SSE connections.

Types

type Account

type Account struct{}

Account exports web API functions for the account web interface. All its methods are exported under api/. Function calls require valid HTTP Authentication credentials of a user.

func (Account) Account

Account returns information about the account: full name, the default domain, and the destinations (keys are email addresses, or localparts to the default domain). todo: replace with a function that returns the whole account, when sherpadoc understands unnamed struct fields.

func (Account) AccountSaveFullName

func (Account) AccountSaveFullName(ctx context.Context, fullName string)

func (Account) DestinationSave

func (Account) DestinationSave(ctx context.Context, destName string, oldDest, newDest config.Destination)

DestinationSave updates a destination. OldDest is compared against the current destination. If it does not match, an error is returned. Otherwise newDest is saved and the configuration reloaded.

func (Account) ImportAbort

func (Account) ImportAbort(ctx context.Context, importToken string) error

ImportAbort aborts an import that is in progress. If the import exists and isn't finished, no changes will have been made by the import.

func (Account) SetPassword

func (Account) SetPassword(ctx context.Context, password string)

SetPassword saves a new password for the account, invalidating the previous password. Sessions are not interrupted, and will keep working. New login attempts must use the new password. Password must be at least 8 characters.

Jump to

Keyboard shortcuts

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