Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *jsondb.DB
DB is a reference to the parent app's JsonDB object.
View Source
var HashCost = 14
HashCost is the cost value given to bcrypt to hash passwords. TODO: make configurable from main package
Functions ¶
func UsernameExists ¶
UsernameExists checks if a username is taken.
Types ¶
type User ¶
type User struct { ID int `json:"id"` Username string `json:"username"` Password string `json:"password"` Admin bool `json:"admin"` Name string `json:"name"` Email string `json:"email"` IsAuthenticated bool `json:"-"` // contains filtered or unexported fields }
User holds information about a user account.
func DeletedUser ¶
func DeletedUser() *User
DeletedUser returns a User object to represent a deleted (non-existing) user.
func LoadReadonly ¶
LoadReadonly loads a user for read-only use, so the Password is masked.
func LoadUsername ¶
LoadUsername loads a user by username.
func (*User) SetPassword ¶
SetPassword sets a user's password by bcrypt hashing it. After this function, u.Password will contain the bcrypt hash.
Click to show internal directories.
Click to hide internal directories.