fixed verification code
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
@@ -11,6 +9,14 @@ import (
|
||||
|
||||
type Filter int
|
||||
|
||||
type AccountStatus string
|
||||
|
||||
const (
|
||||
AccountPendingVerification AccountStatus = "pending_verification"
|
||||
AccountActive AccountStatus = "active"
|
||||
AccountBlocked AccountStatus = "blocked"
|
||||
)
|
||||
|
||||
type AccountBase struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
ArchivableBase `bson:",inline" json:",inline"`
|
||||
@@ -29,10 +35,21 @@ type AccountPublic struct {
|
||||
}
|
||||
|
||||
type Account struct {
|
||||
AccountPublic `bson:",inline" json:",inline"`
|
||||
EmailBackup string `bson:"emailBackup" json:"-"`
|
||||
Password string `bson:"password" json:"-"` // password hash
|
||||
EmailVerifiedAt *time.Time `bson:"emailVerifiedAt,omitempty" json:"-"`
|
||||
AccountPublic `bson:",inline" json:",inline"`
|
||||
Password string `bson:"password" json:"-"` // password hash
|
||||
Status AccountStatus `bson:"status" json:"-"`
|
||||
}
|
||||
|
||||
func (a *Account) Copy() *Account {
|
||||
return &Account{
|
||||
AccountPublic: a.AccountPublic,
|
||||
Password: a.Password,
|
||||
Status: a.Status,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Account) IsActive() bool {
|
||||
return a.Status == AccountActive
|
||||
}
|
||||
|
||||
func (a *Account) HashPassword() error {
|
||||
|
||||
Reference in New Issue
Block a user