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) Alias(alias string) *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 id.UserID) *Builder
- func (b *Builder) Metadata(m Metadata) *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) Verification(v *Verification) *Builder
- func (b *Builder) Workspace(workspace WorkspaceID) *Builder
- type EncodedPassword
- type ID
- type IDList
- type IntegrationID
- type IntegrationIDList
- type List
- type Metadata
- func (m Metadata) Description() string
- func (m Metadata) Lang() language.Tag
- func (m *Metadata) LangFrom(lang string)
- func (m Metadata) PhotoURL() string
- func (m *Metadata) SetDescription(description string)
- func (m *Metadata) SetLang(lang language.Tag)
- func (m *Metadata) SetPhotoURL(url string)
- func (m *Metadata) SetTheme(theme Theme)
- func (m *Metadata) SetWebsite(website string)
- func (m Metadata) Theme() Theme
- func (m Metadata) Website() string
- 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) Alias() string
- 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) MatchPassword(pass string) (bool, error)
- func (u *User) Metadata() *Metadata
- 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) SetMetadata(m Metadata)
- func (u *User) SetPassword(pass string) error
- func (u *User) SetPasswordReset(pr *PasswordReset)
- func (u *User) SetVerification(v *Verification)
- func (u *User) UpdateAlias(alias string)
- func (u *User) UpdateEmail(email string) error
- func (u *User) UpdateName(name string)
- 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 ErrInvalidAlias = rerror.NewE(i18n.T("invalid alias"))
View Source
var (
ErrInvalidEmail = errors.New("invalid email")
)
View Source
var ErrInvalidID = id.ErrInvalidID
View Source
var ErrInvalidName = rerror.NewE(i18n.T("invalid user name"))
View Source
var GenerateVerificationCode = generateCode
View Source
var IDFrom = id.UserIDFrom
View Source
var IDFromRef = id.UserIDFromRef
View Source
var MustID = id.MustUserID
View Source
var NewID = id.NewUserID
View Source
var NewWorkspaceID = id.NewWorkspaceID
View Source
var WorkspaceIDFrom = id.WorkspaceIDFrom
View Source
var WorkspaceIDFromRef = id.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 IDList ¶
type IDList = id.UserIDList
type IntegrationID ¶
type IntegrationID = id.IntegrationID
type IntegrationIDList ¶
type IntegrationIDList = id.IntegrationIDList
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func MetadataFrom ¶
func NewMetadata ¶
func NewMetadata() Metadata
func (Metadata) Description ¶
func (*Metadata) SetDescription ¶
func (*Metadata) SetPhotoURL ¶
func (*Metadata) SetWebsite ¶
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) SetMetadata ¶
func (*User) SetPassword ¶
func (*User) SetPasswordReset ¶
func (u *User) SetPasswordReset(pr *PasswordReset)
func (*User) SetVerification ¶
func (u *User) SetVerification(v *Verification)
func (*User) UpdateAlias ¶
func (*User) UpdateEmail ¶
func (*User) UpdateName ¶
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 = id.WorkspaceID
type WorkspaceIDList ¶
type WorkspaceIDList = id.WorkspaceIDList
Click to show internal directories.
Click to hide internal directories.