Documentation ¶
Index ¶
Constants ¶
View Source
const ( UsernameLengthMax = 16 UsernameLengthMin = 8 PasswordLengthMax = 16 PasswordLengthMin = 8 NameLengthMax = 20 )
View Source
const ( // UserAccountStatusUnknown unknown user UserAccountStatusUnknown = iota // UserAccountStatusActive user normal status UserAccountStatusActive // UserAccountStatusSuspend user has been suspended by admin UserAccountStatusSuspend // UserAccountStatusNotConfirmed user not confirmed UserAccountStatusNotConfirmed )
View Source
const (
SigninKey = "WfAtSGjzzEw8JeL5GZjs99QLzV5bMdxy"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identity ¶
Identity aggregate user and session
func (*Identity) NewAccessToken ¶
NewAccessToken new access token
func (*Identity) NewRefreshToken ¶
NewRefreshToken new refresh token
type NewSessionOption ¶
type NewSessionOption func(p *Session)
func WithDevice ¶
func WithDevice(device Device) NewSessionOption
func WithIdpProvider ¶
func WithIdpProvider(idpProvider string) NewSessionOption
type NewUserOption ¶
func WithNickname ¶
func WithNickname(nickname string) NewUserOption
WithNickname the method will check nickname format
type Session ¶
type Session struct { ID string UserID string CreateAt time.Time UpdateAt time.Time ExpireAt time.Time IPAddress string IdpProvider string Platform string Device Device }
Session define session
func NewSession ¶
type User ¶
type User struct { // ID unique identity number ID string // Username user login identity account Username string // Password user login password Password string // Nickname of user Nickname string // FirstName user first name FirstName string // LastName user last name LastName string // Email user email address Email string // Avatar means user profile picture URL Avatar string // CreatedAt this account create time CreatedAt time.Time // UpdatedAt this account update time UpdatedAt time.Time // Status this account is suspend Status UserAccountStatus }
User define user information
func (*User) ValidatePassword ¶
ValidatePassword check input password match rule password length min <= len <= max password need alphabet password don't have any space or special symbol
func (*User) ValidatePasswordFormat ¶
ValidatePasswordFormat check input password match rule password length min <= len <= max password need alphabet password don't have any space or special symbol
type UserAccountStatus ¶
type UserAccountStatus int8
Click to show internal directories.
Click to hide internal directories.