Documentation ¶
Index ¶
- Constants
- type Account
- type ContactInfo
- type ContactPreferences
- type OTP
- type OTPType
- type Profile
- type RenewToken
- type TempToken
- type Timestamps
- type User
- func (u *User) AddNewEmail(addr string, confirmed bool)
- func (u *User) AddProfile(p Profile)
- func (u *User) ConfirmContactInfo(t string, addr string) error
- func (u User) FindContactInfoById(id string) (ContactInfo, bool)
- func (u User) FindContactInfoByTypeAndAddr(t string, addr string) (ContactInfo, bool)
- func (u User) FindProfile(id string) (Profile, error)
- func (u *User) RemoveContactInfo(id string) error
- func (u *User) RemoveContactInfoFromContactPreferences(id string)
- func (u *User) RemoveProfile(id string) error
- func (u *User) ReplaceContactInfoInContactPreferences(oldId string, newId string)
- func (u *User) SetContactInfoVerificationSent(t string, addr string)
- func (u *User) UpdateProfile(p Profile) error
- type VerificationCode
Constants ¶
View Source
const ( TOKEN_PURPOSE_INVITATION = "invitation" TOKEN_PURPOSE_PASSWORD_RESET = "password-reset" TOKEN_PURPOSE_CONTACT_VERIFICATION = "contact-verification" TOKEN_PURPOSE_SURVEY_LOGIN = "survey-login" TOKEN_PURPOSE_UNSUBSCRIBE_NEWSLETTER = "unsubscribe-newsletter" TOKEN_PURPOSE_RESTORE_ACCOUNT_ID = "restore_account_id" TOKEN_PURPOSE_INACTIVE_USER_NOTIFICATION = "inactive-user-notification" )
View Source
const ACCOUNT_TYPE_EMAIL = "email"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Type string `bson:"type" json:"type"` AccountID string `bson:"accountID" json:"accountID"` AccountConfirmedAt int64 `bson:"accountConfirmedAt" json:"accountConfirmedAt"` Password string `bson:"password" json:"password"` AuthType string `bson:"authType" json:"authType"` VerificationCode VerificationCode `bson:"verificationCode" json:"verificationCode"` PreferredLanguage string `bson:"preferredLanguage" json:"preferredLanguage"` // Rate limiting FailedLoginAttempts []int64 `bson:"failedLoginAttempts" json:"failedLoginAttempts"` PasswordResetTriggers []int64 `bson:"passwordResetTriggers" json:"passwordResetTriggers"` }
type ContactInfo ¶
type ContactInfo struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Type string `bson:"type" json:"type"` ConfirmedAt int64 `bson:"confirmedAt" json:"confirmedAt"` ConfirmationLinkSentAt int64 `bson:"confirmationLinkSentAt" json:"confirmationLinkSentAt"` Email string `bson:"email" json:"email"` Phone string `bson:"phone" json:"phone"` }
type ContactPreferences ¶
type ContactPreferences struct { SubscribedToNewsletter bool `bson:"subscribedToNewsletter" json:"subscribedToNewsletter"` SendNewsletterTo []string `bson:"sendNewsletterTo" json:"sendNewsletterTo"` SubscribedToWeekly bool `bson:"subscribedToWeekly" json:"subscribedToWeekly"` ReceiveWeeklyMessageDayOfWeek int32 `bson:"receiveWeeklyMessageDayOfWeek" json:"receiveWeeklyMessageDayOfWeek"` }
type Profile ¶
type Profile struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Alias string `bson:"alias" json:"alias"` ConsentConfirmedAt int64 `bson:"consentConfirmedAt" json:"consentConfirmedAt"` CreatedAt int64 `bson:"createdAt" json:"createdAt"` AvatarID string `bson:"avatarID" json:"avatarID"` MainProfile bool `bson:"mainProfile" json:"mainProfile"` }
type RenewToken ¶
type TempToken ¶
type TempToken struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"token_id,omitempty"` Token string `bson:"token" json:"token"` Expiration time.Time `bson:"expiration" json:"expiration"` Purpose string `bson:"purpose" json:"purpose"` UserID string `bson:"userID" json:"userID"` Info map[string]string `bson:"info" json:"info"` InstanceID string `bson:"instanceID" json:"instanceID"` }
type Timestamps ¶
type Timestamps struct { LastTokenRefresh int64 `bson:"lastTokenRefresh" json:"lastTokenRefresh"` LastLogin int64 `bson:"lastLogin" json:"lastLogin"` CreatedAt int64 `bson:"createdAt" json:"createdAt"` UpdatedAt int64 `bson:"updatedAt" json:"updatedAt"` LastPasswordChange int64 `bson:"lastPasswordChange" json:"lastPasswordChange"` ReminderToConfirmSentAt int64 `bson:"reminderToConfirmSentAt" json:"reminderToConfirmSentAt"` MarkedForDeletion int64 `bson:"markedForDeletion" json:"markedForDeletion"` }
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` Account Account `bson:"account" json:"account"` Timestamps Timestamps `bson:"timestamps" json:"timestamps"` Profiles []Profile `bson:"profiles" json:"profiles"` ContactPreferences ContactPreferences `bson:"contactPreferences" json:"contactPreferences"` ContactInfos []ContactInfo }
func (*User) AddNewEmail ¶
Add a new email address
func (*User) AddProfile ¶
AddProfile generates unique ID and adds profile to the user's array
func (User) FindContactInfoById ¶
func (u User) FindContactInfoById(id string) (ContactInfo, bool)
func (User) FindContactInfoByTypeAndAddr ¶
func (u User) FindContactInfoByTypeAndAddr(t string, addr string) (ContactInfo, bool)
func (User) FindProfile ¶
FindProfile finds a profile in the user's array
func (*User) RemoveContactInfo ¶
RemoveContactInfo from the user and also all references from the contact preferences
func (*User) RemoveContactInfoFromContactPreferences ¶
RemoveContactInfoFromContactPreferences should delete all references to a contact info object
func (*User) RemoveProfile ¶
RemoveProfile finds and removes profile from the user's array
func (*User) ReplaceContactInfoInContactPreferences ¶
ReplaceContactInfoInContactPreferences to use if a new contact reference should replace to old one
func (*User) SetContactInfoVerificationSent ¶
func (*User) UpdateProfile ¶
UpdateProfile finds and replaces profile in the user's array
Click to show internal directories.
Click to hide internal directories.