user

package
v0.0.0-...-894ab8b Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2014 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package user contains the type definitions for user accounts and the user server interface.

Index

Constants

This section is empty.

Variables

View Source
var AccountNotFound = errors.New("Account not found")

Functions

func ValidName

func ValidName(name string) (bool, i18n.Key)

ValidName checks whether a username is acceptable. If not, a message is returned (a non-empty i18n key).

func ValidPassword

func ValidPassword(passwd string) (bool, i18n.Key)

ValidPassword checks whether a password is strong enough. If not, a message is returned (a non-empty i18n key).

Types

type Account

type Account struct {
	Name         Name
	UILocale     string
	MainLanguage language.Code
	Email        string
	Active       bool
	PasswordHash []byte
}

func NewAccount

func NewAccount(r *NewAccountRequest) *Account

func (*Account) Equals

func (a *Account) Equals(b *Account) bool

type Name

type Name string

type NewAccountRequest

type NewAccountRequest struct {
	Name         Name
	UILocale     string
	Email        string
	PasswordHash []byte
}

type Server

type Server interface {
	NewAccount(r *NewAccountRequest) (*Account, error)
	GetAccount(n Name) (*Account, error)
	GetAccountByEmail(email string) (*Account, error)
	UpdateAccount(a *Account) error

	NewToken(n Name) (string, error)
	ValidToken(n Name, token string) (bool, error)
	DeleteToken(n Name, token string) error
}

Server is the interface a user server should comply to.

Directories

Path Synopsis
Package password provides password hashing and password checks.
Package password provides password hashing and password checks.
Package rpc provides the rpc user client used by the Polyglottis Application and a simple user server wrapper.
Package rpc provides the rpc user client used by the Polyglottis Application and a simple user server wrapper.

Jump to

Keyboard shortcuts

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