Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountNotExistsError ¶
type AccountNotExistsError struct {
Email string
}
AccountNotExistsError will be returned if the user tried to operate on an account which didn't exist in the system.
func (AccountNotExistsError) Error ¶
func (e AccountNotExistsError) Error() string
type Authenticator ¶
type CorruptedPasswordError ¶
type CorruptedPasswordError struct {
Email string
}
CorruptedPasswordError will be returned if the hashed password is corrupted for some reason. This really shouldn't happen, unless the code is buggy or DB hardware has issues.
func (CorruptedPasswordError) Error ¶
func (e CorruptedPasswordError) Error() string
type EmailExistsError ¶
type EmailExistsError struct {
Email string
}
EmailExistsError will be returned if callers try to create a new account with an email that already exists in the system.
func (EmailExistsError) Error ¶
func (e EmailExistsError) Error() string
type InvalidPasswordError ¶
type InvalidPasswordError struct{}
InvalidPasswordError will be returned if the user authenticated with the wrong password.
func (InvalidPasswordError) Error ¶
func (i InvalidPasswordError) Error() string
type InvalidResetTokenError ¶
type InvalidResetTokenError struct{}
InvalidResetTokenError will be returned if the user sent an unrecognized or expired password reset token when trying to reset their password.
func (InvalidResetTokenError) Error ¶
func (err InvalidResetTokenError) Error() string
type PasswordSetter ¶
type PasswordSetter interface { // Change the password associated with the account using a reset token returned recently by // ResetTokenGenerator.NewResetTokenWithAccount(). // // If no account exists with this ID, it returns an AccountNotExistsError. // If the resetToken is wrong, it returns an InvalidResetTokenError. // If the password is unacceptable, it returns a ProhibitedPasswordError. SetForgottenPassword(ctx context.Context, id int64, password, resetToken string) error // Change the password for this account by using the old one, rather than a reset token. // // If the newPassword is unacceptable, it returns a ProhibitedPasswordError. // If no account with the ID exists, it returns an AccountNotExistsError. // If the old password is wrong, it returns an InvalidPasswordError. ChangePassword(ctx context.Context, id int64, oldPassword, newPassword string) error }
type ProhibitedPasswordError ¶
type ProhibitedPasswordError struct{}
ProhibitedPasswordError will be returned if the user tries to set a password which we don't allow.
func (ProhibitedPasswordError) Error ¶
func (e ProhibitedPasswordError) Error() string
type ResetTokenGenerator ¶
type ResetTokenGenerator interface { // This associates a temporary password reset token with the account with the given email. // This token can be used in the PasswordSetter.SetForgottenPassword() method. // // If no Account exists with this email yet, one will be created. The bool return value is // true if the Account is new, and false if it existed already. NewResetToken(ctx context.Context, email string) (Account, bool, error) }
type Store ¶
type Store interface { Authenticator PasswordSetter ResetTokenGenerator }
Store combines all the functions needed to read & write Arguments into a single interface.