Documentation ¶
Index ¶
- Variables
- func CanAccountBeMade(as AccountStorer, a *Account, passwordClearText string) error
- func CheckAndCreateAccount(as AccountStorer, email string, password string, nickname string) error
- func DoPasswordResetRequestIfPossible(as AccountStorer, email string) error
- func GenerateValidationKey() (nullables.NullString, error)
- func IsEmailInUse(as AccountStorer, email string) (bool, error)
- func IsPasswordAcceptable(plaintextPassword string) bool
- type Account
- func (a *Account) ApplyPasswordResetVerificationCode(as AccountStorer, resetVerificationCode string, newPassword string) error
- func (a *Account) ApplyVerificationCode(as AccountStorer, verificationCode string) error
- func (a *Account) AwaitingPasswordReset() bool
- func (a *Account) ExpireSession(as AccountStorer) error
- func (a *Account) SetPassword(cleartext string) error
- func (a *Account) UpdateVoteBank(as AccountStorer, up bool, currentAccountVote int64) error
- func (a Account) Valid() error
- type AccountStorer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoVotesLeft error = errors.New("No votes left in bank!") InvalidUsernameOrPassword error = errors.New("Invalid Username/Password") AccountNotYetVerified error = errors.New("Account not yet verified.") AccountNicknameTooLong error = errors.New("Your nickname cannot be longer than 15 characters!") AccountDoesNotNeedVerification error = errors.New("Account doesn't need verifying!") AccountVerificationCodeNotMatch error = errors.New("Bad verification code!") AccountPasswordResetNotRequested error = errors.New("Password reset not requested!") EmailAddressAlreadyInUse error = errors.New("This email address is already in use!") PasswordNotAcceptable error = errors.New("Password must contain at least 3 of types of characters from uppercase, lowercase, punctuation, and digits, and be at least 8 characters long.") )
Functions ¶
func CanAccountBeMade ¶
func CanAccountBeMade(as AccountStorer, a *Account, passwordClearText string) error
func CheckAndCreateAccount ¶
func CheckAndCreateAccount(as AccountStorer, email string, password string, nickname string) error
func DoPasswordResetRequestIfPossible ¶
func DoPasswordResetRequestIfPossible(as AccountStorer, email string) error
func GenerateValidationKey ¶
func GenerateValidationKey() (nullables.NullString, error)
func IsEmailInUse ¶
func IsEmailInUse(as AccountStorer, email string) (bool, error)
func IsPasswordAcceptable ¶
Types ¶
type Account ¶
type Account struct { Id int64 Email string `sql:"unique; type:varchar(60);" validate:"nonzero"` Nickname string `sql:"type:varchar(15); validate:"nonzero"` Password string `sql:"type:varchar(60);"` VerificationCode nullables.NullString `sql:"type:varchar(32)"` ResetPasswordVerificationCode nullables.NullString `sql:"type:varchar(32)"` CurrentSession nullables.NullString `sql:"type:varchar(32)"` SessionExpires nullables.NullTime VoteBank int64 Admin bool CreatedAt nullables.NullTime UpdatedAt nullables.NullTime DeletedAt nullables.NullTime }
func AttemptLogin ¶
func (*Account) ApplyPasswordResetVerificationCode ¶
func (a *Account) ApplyPasswordResetVerificationCode(as AccountStorer, resetVerificationCode string, newPassword string) error
func (*Account) ApplyVerificationCode ¶
func (a *Account) ApplyVerificationCode(as AccountStorer, verificationCode string) error
func (*Account) AwaitingPasswordReset ¶
func (*Account) ExpireSession ¶
func (a *Account) ExpireSession(as AccountStorer) error
func (*Account) SetPassword ¶
func (*Account) UpdateVoteBank ¶
func (a *Account) UpdateVoteBank(as AccountStorer, up bool, currentAccountVote int64) error
Click to show internal directories.
Click to hide internal directories.