Documentation ¶
Index ¶
- Constants
- func CancelDeletion(s *xorm.Session, user *User) (err error)
- func CheckUserPassword(user *User, password string) error
- func ConfirmDeletion(s *xorm.Session, user *User, token string) (err error)
- func ConfirmEmail(s *xorm.Session, c *EmailConfirm) (err error)
- func DeleteCaldavTokenByID(u *User, id int64) error
- func DisableTOTP(s *xorm.Session, user *User) (err error)
- func EnableTOTP(s *xorm.Session, passcode *TOTPPasscode) (err error)
- func GetTOTPQrCodeForUser(s *xorm.Session, user *User) (qrcode image.Image, err error)
- func GetTables() []interface{}
- func GetUsersByCond(s *xorm.Session, cond builder.Cond) (users map[int64]*User, err error)
- func GetUsersByIDs(s *xorm.Session, userIDs []int64) (users map[int64]*User, err error)
- func GetUsersByUsername(s *xorm.Session, usernames []string, withEmails bool) (users map[int64]*User, err error)
- func HandleFailedTOTPAuth(s *xorm.Session, user *User)
- func HashPassword(password string) (string, error)
- func InitTests()
- func IsErrAccountDisabled(err error) bool
- func IsErrAccountIsNotLocal(err error) bool
- func IsErrCouldNotGetUserID(err error) bool
- func IsErrEmailNotConfirmed(err error) bool
- func IsErrEmptyNewPassword(err error) bool
- func IsErrEmptyOldPassword(err error) bool
- func IsErrInvalidAvatarProvider(err error) bool
- func IsErrInvalidEmailConfirmToken(err error) bool
- func IsErrInvalidPasswordResetToken(err error) bool
- func IsErrInvalidTOTPPasscode(err error) bool
- func IsErrNoEmailProvided(err error) bool
- func IsErrNoPasswordResetToken(err error) bool
- func IsErrNoUsernamePassword(err error) bool
- func IsErrOpenIDCustomScopeMalformed(err error) bool
- func IsErrTOTPAlreadyEnabled(err error) bool
- func IsErrTOTPNotEnabled(err error) bool
- func IsErrUserDoesNotExist(err error) bool
- func IsErrUserEmailExists(err error) bool
- func IsErrUsernameExists(err error) bool
- func IsErrUsernameMustNotContainSpaces(err error) bool
- func IsErrWrongUsernameOrPassword(err error) bool
- func RegisterDeletionNotificationCron()
- func RegisterListeners()
- func RegisterTokenCleanupCron()
- func RequestDeletion(s *xorm.Session, user *User) (err error)
- func RequestUserPasswordResetToken(s *xorm.Session, user *User) (err error)
- func RequestUserPasswordResetTokenByEmail(s *xorm.Session, tr *PasswordTokenRequest) (err error)
- func ResetPassword(s *xorm.Session, reset *PasswordReset) (err error)
- func SetUserStatus(s *xorm.Session, user *User, status Status) (err error)
- func TOTPEnabledForUser(s *xorm.Session, user *User) (bool, error)
- func UpdateEmail(s *xorm.Session, update *EmailUpdate) (err error)
- func UpdateUserPassword(s *xorm.Session, user *User, newPassword string) (err error)
- type APIUserPassword
- type AccountDeletedNotification
- type AccountDeletionConfirmNotification
- type AccountDeletionNotification
- type CreatedEvent
- type EmailConfirm
- type EmailConfirmNotification
- type EmailUpdate
- type ErrAccountDisabled
- type ErrAccountIsNotLocal
- type ErrCouldNotGetUserID
- type ErrEmailNotConfirmed
- type ErrEmptyNewPassword
- type ErrEmptyOldPassword
- type ErrInvalidAvatarProvider
- type ErrInvalidEmailConfirmToken
- type ErrInvalidPasswordResetToken
- type ErrInvalidTOTPPasscode
- type ErrNoOpenIDEmailProvided
- type ErrNoPasswordResetToken
- type ErrNoUsernamePassword
- type ErrOpenIDCustomScopeMalformed
- type ErrTOTPAlreadyEnabled
- type ErrTOTPNotEnabled
- type ErrUserDoesNotExist
- type ErrUserEmailExists
- type ErrUsernameExists
- type ErrUsernameMustNotContainSpaces
- type ErrWrongUsernameOrPassword
- type FailedLoginAttemptNotification
- type IncreaseUserCounter
- type InvalidTOTPNotification
- type Login
- type PasswordAccountLockedAfterInvalidTOTOPNotification
- type PasswordChangedNotification
- type PasswordReset
- type PasswordTokenRequest
- type ProjectUserOpts
- type ResetPasswordNotification
- type Status
- type TOTP
- type TOTPPasscode
- type Token
- type TokenKind
- type User
- func CheckUserCredentials(s *xorm.Session, u *Login) (*User, error)
- func CreateUser(s *xorm.Session, user *User) (newUser *User, err error)
- func GetCurrentUser(c echo.Context) (user *User, err error)
- func GetCurrentUserFromDB(s *xorm.Session, c echo.Context) (user *User, err error)
- func GetFromAuth(a web.Auth) (*User, error)
- func GetUserByID(s *xorm.Session, id int64) (user *User, err error)
- func GetUserByUsername(s *xorm.Session, username string) (user *User, err error)
- func GetUserFromClaims(claims jwt.MapClaims) (user *User, err error)
- func GetUserWithEmail(s *xorm.Session, user *User) (userOut *User, err error)
- func ListAllUsers(s *xorm.Session) (users []*User, err error)
- func ListUsers(s *xorm.Session, search string, opts *ProjectUserOpts) (users []*User, err error)
- func UpdateUser(s *xorm.Session, user *User, forceOverride bool) (updatedUser *User, err error)
- func (u *User) GetFailedPasswordAttemptsKey() string
- func (u *User) GetFailedTOTPAttemptsKey() string
- func (u *User) GetID() int64
- func (u *User) GetName() string
- func (u *User) GetNameAndFromEmail() string
- func (u *User) IsLocalUser() bool
- func (u *User) RouteForDB() int64
- func (u *User) RouteForMail() (string, error)
- func (u *User) SetStatus(s *xorm.Session, status Status) (err error)
- func (u *User) ShouldNotify() (bool, error)
- func (*User) TableName() string
Constants ¶
const ErrCodeAccountDisabled = 1020
ErrCodeAccountDisabled holds the unique world-error code of this error
const ErrCodeAccountIsNotLocal = 1021
ErrCodeAccountIsNotLocal holds the unique world-error code of this error
const ErrCodeCouldNotGetUserID = 1006
ErrCodeCouldNotGetUserID holds the unique world-error code of this error
const ErrCodeEmailNotConfirmed = 1012
ErrCodeEmailNotConfirmed holds the unique world-error code of this error
const ErrCodeEmptyNewPassword = 1013
ErrCodeEmptyNewPassword holds the unique world-error code of this error
const ErrCodeEmptyOldPassword = 1014
ErrCodeEmptyOldPassword holds the unique world-error code of this error
const ErrCodeInvalidAvatarProvider = 1018
ErrCodeInvalidAvatarProvider holds the unique world-error code of this error
const ErrCodeInvalidEmailConfirmToken = 1010
ErrCodeInvalidEmailConfirmToken holds the unique world-error code of this error
const ErrCodeInvalidPasswordResetToken = 1009
ErrCodeInvalidPasswordResetToken holds the unique world-error code of this error
const ErrCodeInvalidTOTPPasscode = 1017
ErrCodeInvalidTOTPPasscode holds the unique world-error code of this error
const ErrCodeNoOpenIDEmailProvided = 1019
ErrCodeNoOpenIDEmailProvided holds the unique world-error code of this error
const ErrCodeNoPasswordResetToken = 1008
ErrCodeNoPasswordResetToken holds the unique world-error code of this error
const ErrCodeNoUsernamePassword = 1004
ErrCodeNoUsernamePassword holds the unique world-error code of this error
const ErrCodeOpenIDCustomScopeMalformed = 1022
ErrCodeNoOpenIDEmailProvided holds the unique world-error code of this error
const ErrCodeTOTPAlreadyEnabled = 1015
ErrCodeTOTPAlreadyEnabled holds the unique world-error code of this error
const ErrCodeTOTPNotEnabled = 1016
ErrCodeTOTPNotEnabled holds the unique world-error code of this error
const ErrCodeUserDoesNotExist = 1005
ErrCodeUserDoesNotExist holds the unique world-error code of this error
const ErrCodeUsernameMustNotContainSpaces = 1022
ErrCodeUsernameMustNotContainSpaces holds the unique world-error code of this error
const ErrCodeWrongUsernameOrPassword = 1011
ErrCodeWrongUsernameOrPassword holds the unique world-error code of this error
const ErrorCodeUserEmailExists = 1002
ErrorCodeUserEmailExists holds the unique world-error code of this error
const ErrorCodeUsernameExists = 1001
ErrorCodeUsernameExists holds the unique world-error code of this error
const IssuerLocal = `local`
Variables ¶
This section is empty.
Functions ¶
func CancelDeletion ¶ added in v0.18.0
CancelDeletion cancels the deletion of a user
func CheckUserPassword ¶
CheckUserPassword checks and verifies a user's password. The user object needs to contain the hashed password from the database.
func ConfirmDeletion ¶ added in v0.18.0
ConfirmDeletion ConformDeletion checks a token and schedules the user for deletion
func ConfirmEmail ¶
func ConfirmEmail(s *xorm.Session, c *EmailConfirm) (err error)
ConfirmEmail handles the confirmation of an email address
func DeleteCaldavTokenByID ¶ added in v0.19.0
func DisableTOTP ¶
DisableTOTP removes all totp settings for a user.
func EnableTOTP ¶
func EnableTOTP(s *xorm.Session, passcode *TOTPPasscode) (err error)
EnableTOTP enables totp for a user. The provided passcode is used to verify the user has a working totp setup.
func GetTOTPQrCodeForUser ¶
GetTOTPQrCodeForUser returns a qrcode for a user's totp setting
func GetTables ¶
func GetTables() []interface{}
GetTables returns all structs which are also a table.
func GetUsersByCond ¶ added in v0.24.0
func GetUsersByIDs ¶ added in v0.16.0
GetUsersByIDs returns a map of users from a slice of user ids
func GetUsersByUsername ¶ added in v0.18.0
func GetUsersByUsername(s *xorm.Session, usernames []string, withEmails bool) (users map[int64]*User, err error)
GetUsersByUsername returns a slice of users with the provided usernames
func HandleFailedTOTPAuth ¶ added in v0.18.0
HandleFailedTOTPAuth handles informing the user of failed TOTP attempts and blocking the account after 10 attempts
func HashPassword ¶ added in v0.17.0
HashPassword hashes a password
func IsErrAccountDisabled ¶ added in v0.18.0
IsErrAccountDisabled checks if an error is a ErrAccountDisabled.
func IsErrAccountIsNotLocal ¶ added in v0.19.0
IsErrAccountIsNotLocal checks if an error is a ErrAccountIsNotLocal.
func IsErrCouldNotGetUserID ¶
IsErrCouldNotGetUserID checks if an error is a ErrCouldNotGetUserID.
func IsErrEmailNotConfirmed ¶
IsErrEmailNotConfirmed checks if an error is a IsErrEmailNotConfirmed.
func IsErrEmptyNewPassword ¶
IsErrEmptyNewPassword checks if an error is a ErrEmptyNewPassword.
func IsErrEmptyOldPassword ¶
IsErrEmptyOldPassword checks if an error is a ErrEmptyOldPassword.
func IsErrInvalidAvatarProvider ¶ added in v0.15.0
IsErrInvalidAvatarProvider checks if an error is a ErrInvalidAvatarProvider.
func IsErrInvalidEmailConfirmToken ¶
IsErrInvalidEmailConfirmToken checks if an error is a ErrInvalidEmailConfirmToken.
func IsErrInvalidPasswordResetToken ¶
IsErrInvalidPasswordResetToken checks if an error is a ErrInvalidPasswordResetToken.
func IsErrInvalidTOTPPasscode ¶
IsErrInvalidTOTPPasscode checks if an error is a ErrInvalidTOTPPasscode.
func IsErrNoEmailProvided ¶ added in v0.18.0
IsErrNoEmailProvided checks if an error is a ErrNoOpenIDEmailProvided.
func IsErrNoPasswordResetToken ¶ added in v0.16.0
IsErrNoPasswordResetToken checks if an error is ErrNoPasswordResetToken
func IsErrNoUsernamePassword ¶
IsErrNoUsernamePassword checks if an error is a ErrNoUsernamePassword.
func IsErrOpenIDCustomScopeMalformed ¶ added in v0.24.0
IsErrNoEmailProvided checks if an error is a ErrNoOpenIDEmailProvided.
func IsErrTOTPAlreadyEnabled ¶
IsErrTOTPAlreadyEnabled checks if an error is a ErrTOTPAlreadyEnabled.
func IsErrTOTPNotEnabled ¶
IsErrTOTPNotEnabled checks if an error is a ErrTOTPNotEnabled.
func IsErrUserDoesNotExist ¶
IsErrUserDoesNotExist checks if an error is a ErrUserDoesNotExist.
func IsErrUserEmailExists ¶
IsErrUserEmailExists checks if an error is a ErrUserEmailExists.
func IsErrUsernameExists ¶
IsErrUsernameExists checks if an error is a ErrUsernameExists.
func IsErrUsernameMustNotContainSpaces ¶ added in v0.21.0
IsErrUsernameMustNotContainSpaces checks if an error is a ErrUsernameMustNotContainSpaces.
func IsErrWrongUsernameOrPassword ¶
IsErrWrongUsernameOrPassword checks if an error is a IsErrEmailNotConfirmed.
func RegisterDeletionNotificationCron ¶ added in v0.18.0
func RegisterDeletionNotificationCron()
func RegisterListeners ¶ added in v0.17.0
func RegisterListeners()
func RegisterTokenCleanupCron ¶ added in v0.18.0
func RegisterTokenCleanupCron()
RegisterTokenCleanupCron registers a cron function to clean up all password reset tokens older than 24 hours
func RequestDeletion ¶ added in v0.18.0
RequestDeletion creates a user deletion confirm token and sends a notification to the user
func RequestUserPasswordResetToken ¶
RequestUserPasswordResetToken sends a user a password reset email.
func RequestUserPasswordResetTokenByEmail ¶ added in v0.15.0
func RequestUserPasswordResetTokenByEmail(s *xorm.Session, tr *PasswordTokenRequest) (err error)
RequestUserPasswordResetTokenByEmail inserts a random token to reset a users password into the databsse
func ResetPassword ¶
func ResetPassword(s *xorm.Session, reset *PasswordReset) (err error)
ResetPassword resets a users password
func SetUserStatus ¶ added in v0.22.1
func TOTPEnabledForUser ¶
TOTPEnabledForUser checks if totp is enabled for a user - not if it is activated, use GetTOTPForUser to check that.
func UpdateEmail ¶
func UpdateEmail(s *xorm.Session, update *EmailUpdate) (err error)
UpdateEmail lets a user update their email address
Types ¶
type APIUserPassword ¶
type APIUserPassword struct { // The unique, numeric id of this user. ID int64 `json:"id"` // The user's username. Cannot contain anything that looks like an url or whitespaces. Username string `json:"username" valid:"length(3|250),username" minLength:"3" maxLength:"250"` // The user's password in clear text. Only used when registering the user. The maximum limi is 72 bytes, which may be less than 72 characters. This is due to the limit in the bcrypt hashing algorithm used to store passwords in Vikunja. Password string `json:"password" valid:"bcrypt_password" minLength:"8" maxLength:"72"` // The user's email address Email string `json:"email" valid:"email,length(0|250)" maxLength:"250"` }
APIUserPassword represents a user object without timestamps and a json password field.
func (*APIUserPassword) APIFormat ¶
func (apiUser *APIUserPassword) APIFormat() *User
APIFormat formats an API User into a normal user struct
type AccountDeletedNotification ¶ added in v0.18.0
type AccountDeletedNotification struct {
User *User
}
AccountDeletedNotification represents a AccountDeletedNotification notification
func (*AccountDeletedNotification) Name ¶ added in v0.18.0
func (n *AccountDeletedNotification) Name() string
Name returns the name of the notification
func (*AccountDeletedNotification) ToDB ¶ added in v0.18.0
func (n *AccountDeletedNotification) ToDB() interface{}
ToDB returns the AccountDeletedNotification notification in a format which can be saved in the db
func (*AccountDeletedNotification) ToMail ¶ added in v0.18.0
func (n *AccountDeletedNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for AccountDeletedNotification
type AccountDeletionConfirmNotification ¶ added in v0.18.0
AccountDeletionConfirmNotification represents a AccountDeletionConfirmNotification notification
func (*AccountDeletionConfirmNotification) Name ¶ added in v0.18.0
func (n *AccountDeletionConfirmNotification) Name() string
Name returns the name of the notification
func (*AccountDeletionConfirmNotification) ToDB ¶ added in v0.18.0
func (n *AccountDeletionConfirmNotification) ToDB() interface{}
ToDB returns the AccountDeletionConfirmNotification notification in a format which can be saved in the db
func (*AccountDeletionConfirmNotification) ToMail ¶ added in v0.18.0
func (n *AccountDeletionConfirmNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for AccountDeletionConfirmNotification
type AccountDeletionNotification ¶ added in v0.18.0
AccountDeletionNotification represents a AccountDeletionNotification notification
func (*AccountDeletionNotification) Name ¶ added in v0.18.0
func (n *AccountDeletionNotification) Name() string
Name returns the name of the notification
func (*AccountDeletionNotification) ToDB ¶ added in v0.18.0
func (n *AccountDeletionNotification) ToDB() interface{}
ToDB returns the AccountDeletionNotification notification in a format which can be saved in the db
func (*AccountDeletionNotification) ToMail ¶ added in v0.18.0
func (n *AccountDeletionNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for AccountDeletionNotification
type CreatedEvent ¶ added in v0.17.0
type CreatedEvent struct {
User *User
}
CreatedEvent represents a CreatedEvent event
func (*CreatedEvent) Name ¶ added in v0.17.0
func (t *CreatedEvent) Name() string
Name defines the name for CreatedEvent
type EmailConfirm ¶
type EmailConfirm struct { // The email confirm token sent via email. Token string `json:"token"` }
EmailConfirm holds the token to confirm a mail address
type EmailConfirmNotification ¶ added in v0.17.0
EmailConfirmNotification represents a EmailConfirmNotification notification
func (*EmailConfirmNotification) Name ¶ added in v0.17.0
func (n *EmailConfirmNotification) Name() string
Name returns the name of the notification
func (*EmailConfirmNotification) ToDB ¶ added in v0.17.0
func (n *EmailConfirmNotification) ToDB() interface{}
ToDB returns the EmailConfirmNotification notification in a format which can be saved in the db
func (*EmailConfirmNotification) ToMail ¶ added in v0.17.0
func (n *EmailConfirmNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for EmailConfirmNotification
type EmailUpdate ¶
type EmailUpdate struct { User *User `json:"-"` // The new email address. Needs to be a valid email address. NewEmail string `json:"new_email" valid:"email,length(0|250),required"` // The password of the user for confirmation. Password string `json:"password"` }
EmailUpdate is the data structure to update a user's email address
type ErrAccountDisabled ¶ added in v0.18.0
type ErrAccountDisabled struct {
UserID int64
}
ErrAccountDisabled represents a "AccountDisabled" kind of error.
func (*ErrAccountDisabled) Error ¶ added in v0.18.0
func (err *ErrAccountDisabled) Error() string
func (*ErrAccountDisabled) HTTPError ¶ added in v0.18.0
func (err *ErrAccountDisabled) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrAccountIsNotLocal ¶ added in v0.19.0
type ErrAccountIsNotLocal struct {
UserID int64
}
ErrAccountIsNotLocal represents a "AccountIsNotLocal" kind of error.
func (*ErrAccountIsNotLocal) Error ¶ added in v0.19.0
func (err *ErrAccountIsNotLocal) Error() string
func (*ErrAccountIsNotLocal) HTTPError ¶ added in v0.19.0
func (err *ErrAccountIsNotLocal) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrCouldNotGetUserID ¶
type ErrCouldNotGetUserID struct{}
ErrCouldNotGetUserID represents a "ErrCouldNotGetuser_id" kind of error.
func (ErrCouldNotGetUserID) Error ¶
func (err ErrCouldNotGetUserID) Error() string
func (ErrCouldNotGetUserID) HTTPError ¶
func (err ErrCouldNotGetUserID) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrEmailNotConfirmed ¶
type ErrEmailNotConfirmed struct {
UserID int64
}
ErrEmailNotConfirmed is an error where the email was not confirmed
func (ErrEmailNotConfirmed) Error ¶
func (err ErrEmailNotConfirmed) Error() string
func (ErrEmailNotConfirmed) HTTPError ¶
func (err ErrEmailNotConfirmed) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrEmptyNewPassword ¶
type ErrEmptyNewPassword struct{}
ErrEmptyNewPassword represents a "EmptyNewPassword" kind of error.
func (ErrEmptyNewPassword) Error ¶
func (err ErrEmptyNewPassword) Error() string
func (ErrEmptyNewPassword) HTTPError ¶
func (err ErrEmptyNewPassword) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrEmptyOldPassword ¶
type ErrEmptyOldPassword struct{}
ErrEmptyOldPassword represents a "EmptyOldPassword" kind of error.
func (ErrEmptyOldPassword) Error ¶
func (err ErrEmptyOldPassword) Error() string
func (ErrEmptyOldPassword) HTTPError ¶
func (err ErrEmptyOldPassword) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrInvalidAvatarProvider ¶ added in v0.15.0
type ErrInvalidAvatarProvider struct {
AvatarProvider string
}
ErrInvalidAvatarProvider represents a "InvalidAvatarProvider" kind of error.
func (ErrInvalidAvatarProvider) Error ¶ added in v0.15.0
func (err ErrInvalidAvatarProvider) Error() string
func (ErrInvalidAvatarProvider) HTTPError ¶ added in v0.15.0
func (err ErrInvalidAvatarProvider) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrInvalidEmailConfirmToken ¶
type ErrInvalidEmailConfirmToken struct {
Token string
}
ErrInvalidEmailConfirmToken is an error where the email confirm token is invalid
func (ErrInvalidEmailConfirmToken) Error ¶
func (err ErrInvalidEmailConfirmToken) Error() string
func (ErrInvalidEmailConfirmToken) HTTPError ¶
func (err ErrInvalidEmailConfirmToken) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrInvalidPasswordResetToken ¶
type ErrInvalidPasswordResetToken struct {
Token string
}
ErrInvalidPasswordResetToken is an error where the password reset token is invalid
func (ErrInvalidPasswordResetToken) Error ¶
func (err ErrInvalidPasswordResetToken) Error() string
func (ErrInvalidPasswordResetToken) HTTPError ¶
func (err ErrInvalidPasswordResetToken) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrInvalidTOTPPasscode ¶
type ErrInvalidTOTPPasscode struct {
Passcode string
}
ErrInvalidTOTPPasscode represents a "InvalidTOTPPasscode" kind of error.
func (ErrInvalidTOTPPasscode) Error ¶
func (err ErrInvalidTOTPPasscode) Error() string
func (ErrInvalidTOTPPasscode) HTTPError ¶
func (err ErrInvalidTOTPPasscode) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrNoOpenIDEmailProvided ¶ added in v0.18.0
type ErrNoOpenIDEmailProvided struct { }
ErrNoOpenIDEmailProvided represents a "NoEmailProvided" kind of error.
func (*ErrNoOpenIDEmailProvided) Error ¶ added in v0.18.0
func (err *ErrNoOpenIDEmailProvided) Error() string
func (*ErrNoOpenIDEmailProvided) HTTPError ¶ added in v0.18.0
func (err *ErrNoOpenIDEmailProvided) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrNoPasswordResetToken ¶
type ErrNoPasswordResetToken struct {
UserID int64
}
ErrNoPasswordResetToken represents an error where no password reset token exists for that user
func (ErrNoPasswordResetToken) Error ¶
func (err ErrNoPasswordResetToken) Error() string
func (ErrNoPasswordResetToken) HTTPError ¶
func (err ErrNoPasswordResetToken) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrNoUsernamePassword ¶
type ErrNoUsernamePassword struct{}
ErrNoUsernamePassword represents a "NoUsernamePassword" kind of error.
func (ErrNoUsernamePassword) Error ¶
func (err ErrNoUsernamePassword) Error() string
func (ErrNoUsernamePassword) HTTPError ¶
func (err ErrNoUsernamePassword) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrOpenIDCustomScopeMalformed ¶ added in v0.24.0
type ErrOpenIDCustomScopeMalformed struct { }
ErrNoOpenIDEmailProvided represents a "NoEmailProvided" kind of error.
func (*ErrOpenIDCustomScopeMalformed) Error ¶ added in v0.24.0
func (err *ErrOpenIDCustomScopeMalformed) Error() string
func (*ErrOpenIDCustomScopeMalformed) HTTPError ¶ added in v0.24.0
func (err *ErrOpenIDCustomScopeMalformed) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrTOTPAlreadyEnabled ¶
type ErrTOTPAlreadyEnabled struct{}
ErrTOTPAlreadyEnabled represents a "TOTPAlreadyEnabled" kind of error.
func (ErrTOTPAlreadyEnabled) Error ¶
func (err ErrTOTPAlreadyEnabled) Error() string
func (ErrTOTPAlreadyEnabled) HTTPError ¶
func (err ErrTOTPAlreadyEnabled) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrTOTPNotEnabled ¶
type ErrTOTPNotEnabled struct{}
ErrTOTPNotEnabled represents a "TOTPNotEnabled" kind of error.
func (ErrTOTPNotEnabled) Error ¶
func (err ErrTOTPNotEnabled) Error() string
func (ErrTOTPNotEnabled) HTTPError ¶
func (err ErrTOTPNotEnabled) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrUserDoesNotExist ¶
type ErrUserDoesNotExist struct {
UserID int64
}
ErrUserDoesNotExist represents a "UserDoesNotExist" kind of error.
func (ErrUserDoesNotExist) Error ¶
func (err ErrUserDoesNotExist) Error() string
func (ErrUserDoesNotExist) HTTPError ¶
func (err ErrUserDoesNotExist) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrUserEmailExists ¶
ErrUserEmailExists represents a "UserEmailExists" kind of error.
func (ErrUserEmailExists) Error ¶
func (err ErrUserEmailExists) Error() string
func (ErrUserEmailExists) HTTPError ¶
func (err ErrUserEmailExists) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrUsernameExists ¶
ErrUsernameExists represents a "UsernameAlreadyExists" kind of error.
func (ErrUsernameExists) Error ¶
func (err ErrUsernameExists) Error() string
func (ErrUsernameExists) HTTPError ¶
func (err ErrUsernameExists) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrUsernameMustNotContainSpaces ¶ added in v0.21.0
type ErrUsernameMustNotContainSpaces struct {
Username string
}
ErrUsernameMustNotContainSpaces represents a "UsernameMustNotContainSpaces" kind of error.
func (*ErrUsernameMustNotContainSpaces) Error ¶ added in v0.21.0
func (err *ErrUsernameMustNotContainSpaces) Error() string
func (*ErrUsernameMustNotContainSpaces) HTTPError ¶ added in v0.21.0
func (err *ErrUsernameMustNotContainSpaces) HTTPError() web.HTTPError
HTTPError holds the http error description
type ErrWrongUsernameOrPassword ¶
type ErrWrongUsernameOrPassword struct { }
ErrWrongUsernameOrPassword is an error where the email was not confirmed
func (ErrWrongUsernameOrPassword) Error ¶
func (err ErrWrongUsernameOrPassword) Error() string
func (ErrWrongUsernameOrPassword) HTTPError ¶
func (err ErrWrongUsernameOrPassword) HTTPError() web.HTTPError
HTTPError holds the http error description
type FailedLoginAttemptNotification ¶ added in v0.18.0
type FailedLoginAttemptNotification struct {
User *User
}
FailedLoginAttemptNotification represents a FailedLoginAttemptNotification notification
func (*FailedLoginAttemptNotification) Name ¶ added in v0.18.0
func (n *FailedLoginAttemptNotification) Name() string
Name returns the name of the notification
func (*FailedLoginAttemptNotification) ToDB ¶ added in v0.18.0
func (n *FailedLoginAttemptNotification) ToDB() interface{}
ToDB returns the FailedLoginAttemptNotification notification in a format which can be saved in the db
func (*FailedLoginAttemptNotification) ToMail ¶ added in v0.18.0
func (n *FailedLoginAttemptNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for FailedLoginAttemptNotification
type IncreaseUserCounter ¶ added in v0.17.0
type IncreaseUserCounter struct { }
IncreaseUserCounter represents a listener
func (*IncreaseUserCounter) Handle ¶ added in v0.17.0
func (s *IncreaseUserCounter) Handle(_ *message.Message) (err error)
Handle is executed when the event IncreaseUserCounter listens on is fired
func (*IncreaseUserCounter) Name ¶ added in v0.17.0
func (s *IncreaseUserCounter) Name() string
Name defines the name for the IncreaseUserCounter listener
type InvalidTOTPNotification ¶ added in v0.18.0
type InvalidTOTPNotification struct {
User *User
}
InvalidTOTPNotification represents a InvalidTOTPNotification notification
func (*InvalidTOTPNotification) Name ¶ added in v0.18.0
func (n *InvalidTOTPNotification) Name() string
Name returns the name of the notification
func (*InvalidTOTPNotification) ToDB ¶ added in v0.18.0
func (n *InvalidTOTPNotification) ToDB() interface{}
ToDB returns the InvalidTOTPNotification notification in a format which can be saved in the db
func (*InvalidTOTPNotification) ToMail ¶ added in v0.18.0
func (n *InvalidTOTPNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for InvalidTOTPNotification
type Login ¶
type Login struct { // The username used to log in. Username string `json:"username"` // The password for the user. Password string `json:"password"` // The totp passcode of a user. Only needs to be provided when enabled. TOTPPasscode string `json:"totp_passcode"` // If true, the token returned will be valid a lot longer than default. Useful for "remember me" style logins. LongToken bool `json:"long_token"` }
Login Object to recive user credentials in JSON format
type PasswordAccountLockedAfterInvalidTOTOPNotification ¶ added in v0.18.0
type PasswordAccountLockedAfterInvalidTOTOPNotification struct {
User *User
}
PasswordAccountLockedAfterInvalidTOTOPNotification represents a PasswordAccountLockedAfterInvalidTOTOPNotification notification
func (*PasswordAccountLockedAfterInvalidTOTOPNotification) Name ¶ added in v0.18.0
func (n *PasswordAccountLockedAfterInvalidTOTOPNotification) Name() string
Name returns the name of the notification
func (*PasswordAccountLockedAfterInvalidTOTOPNotification) ToDB ¶ added in v0.18.0
func (n *PasswordAccountLockedAfterInvalidTOTOPNotification) ToDB() interface{}
ToDB returns the PasswordAccountLockedAfterInvalidTOTOPNotification notification in a format which can be saved in the db
func (*PasswordAccountLockedAfterInvalidTOTOPNotification) ToMail ¶ added in v0.18.0
func (n *PasswordAccountLockedAfterInvalidTOTOPNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for PasswordAccountLockedAfterInvalidTOTOPNotification
type PasswordChangedNotification ¶ added in v0.17.0
type PasswordChangedNotification struct {
User *User
}
PasswordChangedNotification represents a PasswordChangedNotification notification
func (*PasswordChangedNotification) Name ¶ added in v0.17.0
func (n *PasswordChangedNotification) Name() string
Name returns the name of the notification
func (*PasswordChangedNotification) ToDB ¶ added in v0.17.0
func (n *PasswordChangedNotification) ToDB() interface{}
ToDB returns the PasswordChangedNotification notification in a format which can be saved in the db
func (*PasswordChangedNotification) ToMail ¶ added in v0.17.0
func (n *PasswordChangedNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for PasswordChangedNotification
type PasswordReset ¶
type PasswordReset struct { // The previously issued reset token. Token string `json:"token"` // The new password for this user. NewPassword string `json:"new_password"` }
PasswordReset holds the data to reset a password
type PasswordTokenRequest ¶
type PasswordTokenRequest struct {
Email string `json:"email" valid:"email,length(0|250)" maxLength:"250"`
}
PasswordTokenRequest defines the request format for password reset resqest
type ProjectUserOpts ¶ added in v0.21.0
type ResetPasswordNotification ¶ added in v0.17.0
ResetPasswordNotification represents a ResetPasswordNotification notification
func (*ResetPasswordNotification) Name ¶ added in v0.17.0
func (n *ResetPasswordNotification) Name() string
Name returns the name of the notification
func (*ResetPasswordNotification) ToDB ¶ added in v0.17.0
func (n *ResetPasswordNotification) ToDB() interface{}
ToDB returns the ResetPasswordNotification notification in a format which can be saved in the db
func (*ResetPasswordNotification) ToMail ¶ added in v0.17.0
func (n *ResetPasswordNotification) ToMail() *notifications.Mail
ToMail returns the mail notification for ResetPasswordNotification
type TOTP ¶
type TOTP struct { ID int64 `xorm:"bigint autoincr not null unique pk" json:"-"` UserID int64 `xorm:"bigint not null" json:"-"` Secret string `xorm:"text not null" json:"secret"` // The totp entry will only be enabled after the user verified they have a working totp setup. Enabled bool `xorm:"null" json:"enabled"` // The totp url used to be able to enroll the user later URL string `xorm:"text null" json:"url"` }
TOTP holds a user's totp setting in the database.
func EnrollTOTP ¶
EnrollTOTP creates a new TOTP entry for the user - it does not enable it yet.
func GetTOTPForUser ¶
GetTOTPForUser returns the current state of totp settings for the user.
func ValidateTOTPPasscode ¶
func ValidateTOTPPasscode(s *xorm.Session, passcode *TOTPPasscode) (t *TOTP, err error)
ValidateTOTPPasscode validated totp codes of users.
type TOTPPasscode ¶
TOTPPasscode is used to validate a users totp passcode
type Token ¶ added in v0.18.0
type Token struct { ID int64 `xorm:"bigint autoincr not null unique pk" json:"id"` UserID int64 `xorm:"not null" json:"-"` Token string `xorm:"varchar(450) not null index" json:"-"` ClearTextToken string `xorm:"-" json:"token"` Kind TokenKind `xorm:"not null" json:"-"` Created time.Time `xorm:"created not null" json:"created"` }
Token is a token a user can use to do things like verify their email or resetting their password
func GenerateNewCaldavToken ¶ added in v0.19.0
func GetCaldavTokens ¶ added in v0.19.0
type User ¶
type User struct { // The unique, numeric id of this user. ID int64 `xorm:"bigint autoincr not null unique pk" json:"id"` // The full name of the user. Name string `xorm:"text null" json:"name"` // The username of the user. Is always unique. Username string `xorm:"varchar(250) not null unique" json:"username" valid:"length(1|250)" minLength:"1" maxLength:"250"` Password string `xorm:"varchar(250) null" json:"-"` // The user's email address. Email string `xorm:"varchar(250) null" json:"email,omitempty" valid:"email,length(0|250)" maxLength:"250"` Status Status `xorm:"default 0" json:"-"` AvatarProvider string `xorm:"varchar(255) null" json:"-"` AvatarFileID int64 `xorm:"null" json:"-"` // Issuer and Subject contain the issuer and subject from the source the user authenticated with. Issuer string `xorm:"text null" json:"-"` Subject string `xorm:"text null" json:"-"` EmailRemindersEnabled bool `xorm:"bool default true" json:"-"` DiscoverableByName bool `xorm:"bool default false index" json:"-"` DiscoverableByEmail bool `xorm:"bool default false index" json:"-"` OverdueTasksRemindersEnabled bool `xorm:"bool default true index" json:"-"` OverdueTasksRemindersTime string `xorm:"varchar(5) not null default '09:00'" json:"-"` DefaultProjectID int64 `xorm:"bigint null index" json:"-"` WeekStart int `xorm:"null" json:"-"` Language string `xorm:"varchar(50) null" json:"-"` Timezone string `xorm:"varchar(255) null" json:"-"` DeletionScheduledAt time.Time `xorm:"datetime null" json:"-"` DeletionLastReminderSent time.Time `xorm:"datetime null" json:"-"` FrontendSettings interface{} `xorm:"json null" json:"-"` ExportFileID int64 `xorm:"bigint null" json:"-"` // A timestamp when this task was created. You cannot change this value. Created time.Time `xorm:"created not null" json:"created"` // A timestamp when this task was last updated. You cannot change this value. Updated time.Time `xorm:"updated not null" json:"updated"` web.Auth `xorm:"-" json:"-"` }
User holds information about an user
func CheckUserCredentials ¶
CheckUserCredentials checks user credentials
func CreateUser ¶
CreateUser creates a new user and inserts it into the database
func GetCurrentUser ¶
GetCurrentUser returns the current user based on its jwt token
func GetCurrentUserFromDB ¶ added in v0.18.0
GetCurrentUserFromDB gets a user from jwt claims and returns the full user from the db.
func GetFromAuth ¶
GetFromAuth returns a user object from a web.Auth object and returns an error if the underlying type is not a user object
func GetUserByID ¶
GetUserByID returns user by its ID
func GetUserByUsername ¶
GetUserByUsername gets a user from its username. This is an extra function to be able to add an extra error check.
func GetUserFromClaims ¶
GetUserFromClaims Returns a new user from jwt claims
func GetUserWithEmail ¶
GetUserWithEmail returns a user object with email
func ListAllUsers ¶ added in v0.17.0
ListAllUsers returns all users
func UpdateUser ¶
UpdateUser updates a user
func (*User) GetFailedPasswordAttemptsKey ¶ added in v0.18.0
func (*User) GetFailedTOTPAttemptsKey ¶ added in v0.18.0
func (*User) GetName ¶ added in v0.17.0
GetName returns the name if the user has one and the username otherwise.
func (*User) GetNameAndFromEmail ¶ added in v0.17.0
GetNameAndFromEmail returns the name and email address for a user. Useful to use in notifications.
func (*User) IsLocalUser ¶ added in v0.22.0
func (*User) RouteForDB ¶ added in v0.17.0
RouteForDB routes all notifications for a user to their id
func (*User) RouteForMail ¶ added in v0.17.0
RouteForMail routes all notifications for a user to its email address