implemented verifiaction db
This commit is contained in:
30
api/pkg/model/verificaton.go
Normal file
30
api/pkg/model/verificaton.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
type VerificationPurpose string
|
||||
|
||||
const (
|
||||
PurposeAccountActivation VerificationPurpose = "account_activation"
|
||||
PurposeEmailChange VerificationPurpose = "email_change"
|
||||
PurposePasswordReset VerificationPurpose = "password_reset"
|
||||
PurposeSensitiveAction VerificationPurpose = "sensitive_action"
|
||||
PurposeMagicLogin VerificationPurpose = "magic_login"
|
||||
)
|
||||
|
||||
type VerificationToken struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
ArchivableBase `bson:",inline" json:",inline"`
|
||||
|
||||
Target string `bson:"target,omitempty" json:"target"`
|
||||
AccountRef bson.ObjectID `bson:"accountRef" json:"accountRef"`
|
||||
Purpose VerificationPurpose `bson:"purpose" json:"purpose"`
|
||||
VerifyTokenHash string `bson:"verifyTokenHash" json:"-"`
|
||||
UsedAt *time.Time `bson:"usedAt,omitempty" json:"-"`
|
||||
ExpiresAt time.Time `bson:"expiresAt" json:"-"`
|
||||
}
|
||||
Reference in New Issue
Block a user