Back to

Package user

Latest Go to latest

The latest major version is .

Published: Sep 3, 2015 | License: MIT | Module:



const (
	//DS is the location of the user datastore
	DS = "core" + string(os.PathSeparator) + "user.ds"


var ErrLogon = errors.New("Invalid user and / or password")

ErrLogon is when a user fails a logon

func All

func All() (map[string]*User, error)

All returns all the users in a freehold instance

func Delete

func Delete(username string) error

Delete deletes a user

func New

func New(username string, u *User) error

New creates a new user

type User

type User struct {
	Name        string `json:"name,omitempty"`
	Password    string `json:"password,omitempty"`
	EncPassword []byte `json:"encPassword,omitempty"`
	HomeApp     string `json:"homeApp,omitempty"`
	Admin       bool   `json:"admin,omitempty"`
	// contains filtered or unexported fields

User is a user in a freehold instance

func Get

func Get(username string) (*User, error)

Get retrieves a user

func (*User) Login

func (u *User) Login(password string) error

Login is when a user attempts to log in

func (*User) Update

func (u *User) Update() error

Update updates the passed in user

func (*User) UpdatePassword

func (u *User) UpdatePassword(password string) error

UpdatePassword is called when a user changes their password

func (*User) Username

func (u *User) Username() string

Username is the user's username

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier