pwch

package
v0.0.0-...-aa65427 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LastEmailSent time.Time

LastEmailSent is used for rate limiting.

View Source
var OneTimeURLs = struct {
	sync.RWMutex
	M map[string]time.Time
}{M: make(map[string]time.Time)}

OneTimeURLs is where valid one time URLs are stored

key = random token + username + domain value = time at creation of entry

entries are deleted either after the password got changed or when the entry expires.

View Source
var Version = "3.5.6"

Functions

func DeleteFromHashMap

func DeleteFromHashMap(key string)

func EmailSendHandler

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

func PasswordChangeHandler

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

func PasswordSubmitHandler

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

func PrintBuildInfo

func PrintBuildInfo()

func PrintHelp

func PrintHelp()

func ReadConfig

func ReadConfig(cfg *Config, configPath string) error

func SubmitEmailHandler

func SubmitEmailHandler(w http.ResponseWriter, _ *http.Request)

Types

type Config

type Config struct {
	Domain     string `yaml:"domain"`
	URLPrefix  string `yaml:"url_prefix"`
	AssetsPath string `yaml:"assets_path"`
	Server     struct {
		SocketPath string `yaml:"socket_path"`
	} `yaml:"server"`
	DB struct {
		Host     string `yaml:"host"`
		DBName   string `yaml:"db_name"`
		User     string `yaml:"user"`
		Password string `yaml:"password"`
		SSLMode  string `yaml:"ssl_mode"`
	} `yaml:"db"`
	Bcrypt struct {
		Cost int `yaml:"cost"`
	} `yaml:"bcrypt"`
	SMTP struct {
		Host          string `yaml:"host"`
		Port          string `yaml:"port"`
		LoginUser     string `yaml:"login_user"`
		LoginPassword string `yaml:"login_password"`
		Sender        string `yaml:"sender"`
	} `yaml:"smtp"`
	PasswordPolicy struct {
		MinLength   int  `yaml:"min_length"`
		MaxLength   int  `yaml:"max_length"`
		LowerCase   bool `yaml:"lower_case"`
		UpperCase   bool `yaml:"upper_case"`
		Digits      bool `yaml:"digits"`
		SepcialChar bool `yaml:"special_char"`
	} `yaml:"password_policy"`
	OTL struct {
		TokenLength int           `yaml:"token_length"`
		ValidFor    time.Duration `yaml:"valid_for"`
	} `yaml:"otl"`
}
var Cfg Config

Jump to

Keyboard shortcuts

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