logins

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PasswordForTest string

Functions

func AskAndSavePasswordForHTTPDigest

func AskAndSavePasswordForHTTPDigest(loginsmanager Manager, loginobj Login, realm string) error

func AskPassword

func AskPassword(username string) ([]byte, error)

Types

type Login

type Login struct {
	Login        string `json:"id"` // unique id
	Email        string `json:"email"`
	Passwordhash string //md5hex("%s:%s:%s", username,realm,password)
	Disabled     bool   `json:"disabled"`
	// contains filtered or unexported fields
}

Login represents a user

type Logins

type Logins struct {
	Version string  `json:"version"`
	Logins  []Login `json:"logins"` // goes to disk
	// contains filtered or unexported fields
}
var Store Logins // type Logins uses interface 'manager'

func ReadLoginsJSON

func ReadLoginsJSON(filename string) (Logins, error)

ReadLoginsJSON from file. Remember to call sortLogins after this.

func (*Logins) Add

func (ls *Logins) Add(login string, email string, newhash string) (Login, error)

func (*Logins) Find

func (ls *Logins) Find(login string, lockForUpdate bool) (*Login, int, error)

func (*Logins) OpenDB

func (ls *Logins) OpenDB(path string) error

func (*Logins) Save

func (ls *Logins) Save() error

type Manager

type Manager interface {
	Save() error
	Add(login string, email string, password string) (Login, error)
	Find(login string, lockX bool) (*Login, int, error)
	OpenDB(path string) error
}

Jump to

Keyboard shortcuts

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