user

package
v0.0.0-...-789275d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewUser

type NewUser struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

NewUser defines the set of data received to create a new user.

type UpdateUser

type UpdateUser struct {
	Email    string `json:"email"`
	PublicID string `json:"public_id"`
}

UpdateUser defines the set of data sent when updating a users data.

func (UpdateUser) Fields

func (u UpdateUser) Fields() map[string]interface{}

Fields returns a map representing the data of the user.

func (UpdateUser) Table

func (u UpdateUser) Table() string

Table returns the given table which the given struct corresponds to.

type UpdateUserPassword

type UpdateUserPassword struct {
	PublicID        string `json:"public_id"`
	Password        string `json:"password"`
	PasswordConfirm string `json:"password_confirm"`
}

UpdateUserPassword defines the set of data sent when updating a users password.

type User

type User struct {
	Email     string           `json:"email"`
	PublicID  string           `json:"public_id"`
	PrivateID string           `json:"private_id,omitempty"`
	Hash      string           `json:"hash,omitempty"`
	Profile   *profile.Profile `json:"profile,omitempty"`
}

User is a type defining the given user related fields for a given.

func New

func New(nw NewUser) (*User, error)

New returns a new User instance based on the provided data.

func (User) Authenticate

func (u User) Authenticate(password string) error

Authenticate attempts to authenticate the giving password to the provided user.

func (*User) ChangePassword

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

ChangePassword uses the provided password to set the users password hash.

func (User) Fields

func (u User) Fields() map[string]interface{}

Fields returns a map representing the data of the user.

func (User) SafeFields

func (u User) SafeFields() map[string]interface{}

SafeFields returns a map representing the data of the user with important security fields removed.

func (User) Table

func (u User) Table() string

Table returns the given table which the given struct corresponds to.

func (*User) WithFields

func (u *User) WithFields(fields map[string]interface{}) error

WithFields attempts to syncing the giving data within the provided map into it's own fields.

Jump to

Keyboard shortcuts

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