From 8fd179347b175cb5e2f94083a60f128ccdb812f6 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Thu, 24 Feb 2022 17:10:17 +0800 Subject: [PATCH 1/2] fix: magiclink & recover verification should send login action to audit log --- api/verify.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/verify.go b/api/verify.go index 3c5f8b691..fc4a6098e 100644 --- a/api/verify.go +++ b/api/verify.go @@ -200,7 +200,7 @@ func (a *API) recoverVerify(ctx context.Context, conn *storage.Connection, user return terr } if !user.IsConfirmed() { - if terr = models.NewAuditLogEntry(tx, instanceID, user, models.UserSignedUpAction, nil); terr != nil { + if terr = models.NewAuditLogEntry(tx, instanceID, user, models.LoginAction, nil); terr != nil { return terr } From a99565b21e5b0442da30ca41cc901cb5c77ec641 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Fri, 25 Feb 2022 10:16:09 +0800 Subject: [PATCH 2/2] fix: add login action for recover / magiclink verify --- api/verify.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/verify.go b/api/verify.go index fc4a6098e..bf9191255 100644 --- a/api/verify.go +++ b/api/verify.go @@ -200,7 +200,7 @@ func (a *API) recoverVerify(ctx context.Context, conn *storage.Connection, user return terr } if !user.IsConfirmed() { - if terr = models.NewAuditLogEntry(tx, instanceID, user, models.LoginAction, nil); terr != nil { + if terr = models.NewAuditLogEntry(tx, instanceID, user, models.UserSignedUpAction, nil); terr != nil { return terr } @@ -210,6 +210,13 @@ func (a *API) recoverVerify(ctx context.Context, conn *storage.Connection, user if terr = user.Confirm(tx); terr != nil { return terr } + } else { + if terr = models.NewAuditLogEntry(tx, instanceID, user, models.LoginAction, nil); terr != nil { + return terr + } + if terr = triggerEventHooks(ctx, tx, LoginEvent, user, instanceID, config); terr != nil { + return terr + } } return nil })