Documentation ¶
Index ¶
- Constants
- Variables
- func MockGenerateVerificationCode(code string) func()
- func ValidatePasswordFormat(pass string) error
- type Auth
- type Auths
- type BcryptPasswordEncoder
- type Builder
- func (b *Builder) Auths(auths []Auth) *Builder
- func (b *Builder) Build() (*User, error)
- func (b *Builder) Email(email string) *Builder
- func (b *Builder) EncodedPassword(p EncodedPassword) *Builder
- func (b *Builder) ID(id accountdomain.UserID) *Builder
- func (b *Builder) Lang(lang language.Tag) *Builder
- func (b *Builder) LangFrom(lang string) *Builder
- func (b *Builder) MustBuild() *User
- func (b *Builder) Name(name string) *Builder
- func (b *Builder) NewID() *Builder
- func (b *Builder) ParseID(id string) *Builder
- func (b *Builder) PasswordPlainText(p string) *Builder
- func (b *Builder) PasswordReset(pr *PasswordReset) *Builder
- func (b *Builder) Theme(t Theme) *Builder
- func (b *Builder) Verification(v *Verification) *Builder
- func (b *Builder) Workspace(workspace WorkspaceID) *Builder
- type EncodedPassword
- type ID
- type IDList
- type List
- type MockPasswordEncoder
- type NoopPasswordEncoder
- type PasswordEncoder
- type PasswordReset
- type Simple
- type SimpleList
- type Theme
- type User
- func (u *User) AddAuth(a Auth) bool
- func (u *User) Auths() Auths
- func (u *User) ClearAuths()
- func (u *User) Clone() *User
- func (u *User) ContainAuth(a Auth) bool
- func (u *User) Email() string
- func (u *User) GetAuthByProvider(provider string) *Auth
- func (u *User) HasAuthProvider(p string) bool
- func (u *User) Host() string
- func (u *User) ID() ID
- func (u *User) Lang() language.Tag
- func (u *User) MatchPassword(pass string) (bool, error)
- func (u *User) Name() string
- func (u *User) Password() []byte
- func (u *User) PasswordReset() *PasswordReset
- func (u *User) RemoveAuth(a Auth) bool
- func (u *User) RemoveAuthByProvider(provider string) bool
- func (u *User) SetPassword(pass string) error
- func (u *User) SetPasswordReset(pr *PasswordReset)
- func (u *User) SetVerification(v *Verification)
- func (u *User) Theme() Theme
- func (u *User) UpdateEmail(email string) error
- func (u *User) UpdateLang(lang language.Tag)
- func (u *User) UpdateName(name string)
- func (u *User) UpdateTheme(t Theme)
- func (u *User) UpdateWorkspace(workspace WorkspaceID)
- func (u *User) Verification() *Verification
- func (u *User) WithHost(host string) *User
- func (u *User) Workspace() WorkspaceID
- type Verification
- type WorkspaceID
- type WorkspaceIDList
Constants ¶
View Source
const ( ProviderReearth = "reearth" ProviderAuth0 = "auth0" )
Variables ¶
View Source
var ( DefaultPasswordEncoder PasswordEncoder = &BcryptPasswordEncoder{} ErrEncodingPassword = rerror.NewE(i18n.T("encoding password")) ErrInvalidPassword = rerror.NewE(i18n.T("invalid password")) ErrPasswordLength = rerror.NewE(i18n.T("password at least 8 characters")) ErrPasswordUpper = rerror.NewE(i18n.T("password should have upper case letters")) ErrPasswordLower = rerror.NewE(i18n.T("password should have lower case letters")) ErrPasswordNumber = rerror.NewE(i18n.T("password should have numbers")) )
View Source
var (
ErrInvalidEmail = errors.New("invalid email")
)
View Source
var ErrInvalidID = accountdomain.ErrInvalidID
View Source
var ErrInvalidName = rerror.NewE(i18n.T("invalid user name"))
View Source
var GenerateVerificationCode = generateCode
View Source
var IDFrom = accountdomain.UserIDFrom
View Source
var IDFromRef = accountdomain.UserIDFromRef
View Source
var MustID = accountdomain.MustUserID
View Source
var NewID = accountdomain.NewUserID
View Source
var NewWorkspaceID = accountdomain.NewWorkspaceID
View Source
var WorkspaceIDFrom = accountdomain.WorkspaceIDFrom
View Source
var WorkspaceIDFromRef = accountdomain.WorkspaceIDFromRef
Functions ¶
func MockGenerateVerificationCode ¶
func MockGenerateVerificationCode(code string) func()
func ValidatePasswordFormat ¶
Types ¶
type Auths ¶
type Auths []Auth
func (Auths) GetByProvider ¶
func (Auths) HasProvider ¶
func (Auths) RemoveByProvider ¶
type BcryptPasswordEncoder ¶
type BcryptPasswordEncoder struct{}
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) EncodedPassword ¶
func (b *Builder) EncodedPassword(p EncodedPassword) *Builder
func (*Builder) PasswordPlainText ¶
func (*Builder) PasswordReset ¶
func (b *Builder) PasswordReset(pr *PasswordReset) *Builder
func (*Builder) Verification ¶
func (b *Builder) Verification(v *Verification) *Builder
func (*Builder) Workspace ¶
func (b *Builder) Workspace(workspace WorkspaceID) *Builder
type EncodedPassword ¶
type EncodedPassword []byte
func MustEncodedPassword ¶
func MustEncodedPassword(pass string) EncodedPassword
func NewEncodedPassword ¶
func NewEncodedPassword(pass string) (EncodedPassword, error)
func (EncodedPassword) Clone ¶
func (p EncodedPassword) Clone() EncodedPassword
type ID ¶
type ID = accountdomain.UserID
type IDList ¶
type IDList = accountdomain.UserIDList
type MockPasswordEncoder ¶
type MockPasswordEncoder struct{ Mock []byte }
type NoopPasswordEncoder ¶
type NoopPasswordEncoder struct{}
type PasswordEncoder ¶
type PasswordReset ¶
func NewPasswordReset ¶
func NewPasswordReset() *PasswordReset
func PasswordResetFrom ¶
func PasswordResetFrom(token string, createdAt time.Time) *PasswordReset
func (*PasswordReset) Clone ¶
func (pr *PasswordReset) Clone() *PasswordReset
func (*PasswordReset) Validate ¶
func (pr *PasswordReset) Validate(token string) bool
type Simple ¶
func SimpleFrom ¶
type SimpleList ¶
type SimpleList []*Simple
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) ClearAuths ¶
func (u *User) ClearAuths()
func (*User) ContainAuth ¶
func (*User) GetAuthByProvider ¶
func (*User) HasAuthProvider ¶
func (*User) PasswordReset ¶
func (u *User) PasswordReset() *PasswordReset
func (*User) RemoveAuth ¶
func (*User) RemoveAuthByProvider ¶
func (*User) SetPassword ¶
func (*User) SetPasswordReset ¶
func (u *User) SetPasswordReset(pr *PasswordReset)
func (*User) SetVerification ¶
func (u *User) SetVerification(v *Verification)
func (*User) UpdateEmail ¶
func (*User) UpdateLang ¶
func (*User) UpdateName ¶
func (*User) UpdateTheme ¶
func (*User) UpdateWorkspace ¶
func (u *User) UpdateWorkspace(workspace WorkspaceID)
func (*User) Verification ¶
func (u *User) Verification() *Verification
func (*User) Workspace ¶
func (u *User) Workspace() WorkspaceID
type Verification ¶
type Verification struct {
// contains filtered or unexported fields
}
func NewVerification ¶
func NewVerification() *Verification
func VerificationFrom ¶
func VerificationFrom(c string, e time.Time, b bool) *Verification
func (*Verification) Code ¶
func (v *Verification) Code() string
func (*Verification) Expiration ¶
func (v *Verification) Expiration() time.Time
func (*Verification) IsExpired ¶
func (v *Verification) IsExpired() bool
func (*Verification) IsVerified ¶
func (v *Verification) IsVerified() bool
func (*Verification) SetVerified ¶
func (v *Verification) SetVerified(b bool)
type WorkspaceID ¶
type WorkspaceID = accountdomain.WorkspaceID
type WorkspaceIDList ¶
type WorkspaceIDList = accountdomain.WorkspaceIDList
Click to show internal directories.
Click to hide internal directories.