Adding Live 2fa capacity

* Some requests may be sensitive enough to require a secondary
two-factor authorization on the spot
* Examples: changing password, changing email address, viewing API
tokens etc
* This creates a core handler that can attach to any Auth-able method
which will require a "twofactorcode" query param before processing
This commit is contained in:
🐙PiperYxzzy
2022-05-01 22:34:07 +02:00
parent 67efb0600f
commit dbdd4cb650
4 changed files with 98 additions and 0 deletions

View File

@@ -3,6 +3,8 @@ package models
import (
"testing"
"time"
"github.com/yxzzy-wtf/gin-gonic-prepack/database"
)
func TestBadPasswords(t *testing.T) {
@@ -75,6 +77,8 @@ func TestTwoFactorWhenNotSet(t *testing.T) {
}
func TestTwoFactor(t *testing.T) {
database.InitTestDb()
a := Auth{}
a.TwoFactorSecret = "AAAAAAAAAAAAAAAA"