[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
|
@ -9,6 +9,7 @@ import (
|
|||
"code.gitea.io/gitea/models/db"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
|
@ -130,6 +131,12 @@ func AssertSuccessfulInsert(t assert.TestingT, beans ...any) {
|
|||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// AssertSuccessfulDelete assert that beans is successfully deleted
|
||||
func AssertSuccessfulDelete(t require.TestingT, beans ...any) {
|
||||
err := db.DeleteBeans(db.DefaultContext, beans...)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// AssertCount assert the count of a bean
|
||||
func AssertCount(t assert.TestingT, bean, expected any) bool {
|
||||
return assert.EqualValues(t, expected, GetCount(t, bean))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue