Documentation ¶
Index ¶
- Constants
- func NewSendVerificationEmailErr(errType SendVerificationEmailErrType, msg string) error
- type AccountType
- type SendVerificationEmailErrType
- type SendVerificationEmailError
- type User
- type UserService
- func (u *UserService) CheckLicenseValid(user *User) bool
- func (u *UserService) CreateUser(ctx context.Context, name string, email string, password string) (*User, error)
- func (u *UserService) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (u *UserService) GetUserById(ctx context.Context, id uint) (*User, error)
- func (u *UserService) GetUserByUuid(ctx context.Context, uuid string) (*User, error)
- func (u *UserService) ResendVerificationEmail(ctx context.Context, email string, password string) error
- func (u *UserService) ResetPassword(ctx context.Context, email string) error
- func (u *UserService) ResetPwAuthCodeExchange(ctx context.Context, token string, email string) (string, error)
- func (u *UserService) SetNewPassword(ctx context.Context, email string, authCode string, newPassword string) error
- func (u *UserService) VerifyEmail(ctx context.Context, userUUID string, verificationToken string) error
Constants ¶
View Source
const (
EmailVerificationTokenLength = 16
)
View Source
const (
TRIAL_DURATION_DAYS = 14
)
Variables ¶
This section is empty.
Functions ¶
func NewSendVerificationEmailErr ¶
func NewSendVerificationEmailErr(errType SendVerificationEmailErrType, msg string) error
Types ¶
type AccountType ¶
type AccountType int
const ( TrialAccount AccountType = iota BasicAccount TestAccount // Account with no expiry (remove after beta test) )
func (AccountType) String ¶
func (a AccountType) String() string
type SendVerificationEmailErrType ¶
type SendVerificationEmailErrType int
const ( ResendDisabled SendVerificationEmailErrType = iota UserVerified )
type SendVerificationEmailError ¶
type SendVerificationEmailError struct {
// contains filtered or unexported fields
}
func (SendVerificationEmailError) ErrType ¶
func (s SendVerificationEmailError) ErrType() SendVerificationEmailErrType
func (SendVerificationEmailError) Error ¶
func (s SendVerificationEmailError) Error() string
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func InitUserService ¶
func InitUserService(db *gorm.DB, emailService *email.EmailService) *UserService
func (*UserService) CheckLicenseValid ¶
func (u *UserService) CheckLicenseValid(user *User) bool
func (*UserService) CreateUser ¶
func (u *UserService) CreateUser(ctx context.Context, name string, email string, password string) (*User, error)
Creates a user. Will hash provided password before storing into DB
func (*UserService) GetUserByEmail ¶
func (*UserService) GetUserById ¶
func (*UserService) GetUserByUuid ¶
Get user by UUID
func (*UserService) ResendVerificationEmail ¶
func (u *UserService) ResendVerificationEmail(ctx context.Context, email string, password string) error
Resend verification email (for users that already exist) Will return an error if user does not exist Idempotent within a certain period of time
func (*UserService) ResetPassword ¶
func (u *UserService) ResetPassword(ctx context.Context, email string) error
Sends initial request to reset password for user with email Sends an email to the user with reset token if account with email exists
func (*UserService) ResetPwAuthCodeExchange ¶
func (*UserService) SetNewPassword ¶
func (*UserService) VerifyEmail ¶
Click to show internal directories.
Click to hide internal directories.