Documentation ¶
Overview ¶
Package user holds the models related to users.
Index ¶
- func AreThereAnyUsers() bool
- func GenerateInviteToken(n int) string
- func InsertInvitation(invite Invitation) error
- func InviteEmailExists(email string) bool
- func InviteTokenExists(token string) bool
- func IsEmailUnique(email string) bool
- func IsEmailValidated(address string) bool
- func RemoveInvitation(token string) error
- func ValidatePassword(password string) []string
- func ValidateUserForm(newUser Form, isNew bool) []string
- type Form
- type Invitation
- type Profile
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreThereAnyUsers ¶
func AreThereAnyUsers() bool
AreThereAnyUsers checks to see if the database has any users or not.
func GenerateInviteToken ¶
GenerateInviteToken creates a token, n characters long, made up of the charactesr listed in the characters string above.
func InsertInvitation ¶
func InsertInvitation(invite Invitation) error
InsertInvitation adds the provided invitation to the database.
func InviteEmailExists ¶
InviteEmailExists returns true if an invite is already in the system.
func InviteTokenExists ¶
InviteTokenExists returns true if an invite is already in the system.
func IsEmailUnique ¶
IsEmailUnique lets you verify if a user exists in the database already. False means they are there.ss
func IsEmailValidated ¶
IsEmailValidated returns the value of User.IsEmailValidated
func RemoveInvitation ¶
RemoveInvitation removes an invitation from the database.
func ValidatePassword ¶
ValidatePassword validates the offered user password.
func ValidateUserForm ¶
ValidateUserForm validates the data provided and returns a slice of strings if there are any errors. Its first argument is a filled in UserForm struct. This is the data to be validated/ Its second argument is a bool value declaring if the form is for a new user rather than just updating a user.
Types ¶
type Invitation ¶
Invitation is the model used when sending invitations to a user.
func InviteByToken ¶
func InviteByToken(token string) (*Invitation, error)
InviteByToken retrieves an invitation from the database matching the given token.
func NewInvitation ¶
func NewInvitation(email string) Invitation
NewInvitation accepts an email address and creates a new invitation.
type User ¶
type User struct { ID bson.ObjectId `bson:"_id,omitempty"` Email string Password string IsAdmin bool EmailIsVerified bool Timestamp time.Time LastUpdated time.Time Profile Profile }
User is the user model
func CreateUserFromForm ¶
CreateUserFromForm creates a new user object from the data provided via a UserForm object.
func GetUserByEmail ¶
GetUserByEmail grabs a user object from the database based on the email address.
func (*User) Authenticate ¶
Authenticate allows the login method to make sure we have the right person.
func (*User) SetPassword ¶
SetPassword sets the password on the user object
Directories ¶
Path | Synopsis |
---|---|
Package userhandlers holds the handlers/views for the User mode.
|
Package userhandlers holds the handlers/views for the User mode. |