[SEC] Notify owner about TOTP enrollment
- In the spirit of #4635 - Notify the owner when their account is getting enrolled into TOTP. The message is changed according if they have security keys or not. - Integration test added.
This commit is contained in:
parent
2285526e93
commit
a7e96aae66
6 changed files with 137 additions and 0 deletions
|
@ -243,6 +243,11 @@ func EnrollTwoFactorPost(ctx *context.Context) {
|
|||
log.Error("Unable to save changes to the session: %v", err)
|
||||
}
|
||||
|
||||
if err := mailer.SendTOTPEnrolled(ctx, ctx.Doer); err != nil {
|
||||
ctx.ServerError("SendTOTPEnrolled", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = auth.NewTwoFactor(ctx, t); err != nil {
|
||||
// FIXME: We need to handle a unique constraint fail here it's entirely possible that another request has beaten us.
|
||||
// If there is a unique constraint fail we should just tolerate the error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue