Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ func (a *API) adminUserCreate(w http.ResponseWriter, r *http.Request) error {
"user_id": user.ID,
"user_email": user.Email,
"user_phone": user.Phone,
"provider": providers[0], // complying with the user.AppMetaData["provider"] field as above
}); terr != nil {
return terr
}
Expand Down
7 changes: 7 additions & 0 deletions internal/api/provider_constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package api

// Provider constants
const (
EmailProvider = "email"
PhoneProvider = "phone"
)
12 changes: 9 additions & 3 deletions internal/api/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ func (a *API) signupVerify(r *http.Request, ctx context.Context, conn *storage.C
}
}

if terr = models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", nil); terr != nil {
if terr = models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", map[string]interface{}{
"provider": EmailProvider,
}); terr != nil {
return terr
}

Expand Down Expand Up @@ -357,7 +359,9 @@ func (a *API) recoverVerify(r *http.Request, conn *storage.Connection, user *mod
return terr
}
if !user.IsConfirmed() {
if terr = models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", nil); terr != nil {
if terr = models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", map[string]interface{}{
"provider": EmailProvider,
}); terr != nil {
return terr
}

Expand All @@ -383,7 +387,9 @@ func (a *API) smsVerify(r *http.Request, conn *storage.Connection, user *models.
err := conn.Transaction(func(tx *storage.Connection) error {

if params.Type == smsVerification {
if terr := models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", nil); terr != nil {
if terr := models.NewAuditLogEntry(r, tx, user, models.UserSignedUpAction, "", map[string]interface{}{
"provider": PhoneProvider,
}); terr != nil {
return terr
}
if terr := user.ConfirmPhone(tx); terr != nil {
Expand Down
Loading