Skip to content

Commit

Permalink
pkg/authapi: added CreatedAt index to pending users
Browse files Browse the repository at this point in the history
  • Loading branch information
zeim839 committed Apr 8, 2024
1 parent efb7d42 commit 4e5d06c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pkg/authapi/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ func (cntrl *DefaultAPIController) SignUpRoute() gin.HandlerFunc {
pendingUser := authdb.PendingUserModel{
Email: req.Email,
User: authdb.UserModel{
ID: "",
Email: req.Email,
Password: string(hash),
FirstName: req.FirstName,
LastName: req.LastName,
Realms: []string{},
LastVerified: 0,
CreatedAt: 0,
ID: "",
Email: req.Email,
Password: string(hash),
FirstName: req.FirstName,
LastName: req.LastName,
Realms: []string{},
CreatedAt: 0,
},
TTL: 600, // 10 minutes.
CreatedAt: time.Now().Unix(),
TTL: 600, // 10 minutes.
}

// Save pending user to database.
Expand Down Expand Up @@ -211,7 +211,6 @@ func (cntrl *DefaultAPIController) VerifyEmailRoute() gin.HandlerFunc {

// Update user creation dates.
pending.User.CreatedAt = time.Now().Unix()
pending.User.LastVerified = time.Now().Unix()

// Sign up.
if _, err := cntrl.db.Users().Create(pending.User); err != nil {
Expand Down

0 comments on commit 4e5d06c

Please sign in to comment.