Fix OTP form implementation

This commit is contained in:
Melon 2025-03-14 14:43:34 +00:00
parent 900c220a84
commit 49cf77d681
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -22,6 +22,7 @@ type otpLoginDB interface {
} }
var _ auth.Provider = (*OtpLogin)(nil) var _ auth.Provider = (*OtpLogin)(nil)
var _ auth.Form = (*OtpLogin)(nil)
type OtpLogin struct { type OtpLogin struct {
DB otpLoginDB DB otpLoginDB
@ -29,9 +30,9 @@ type OtpLogin struct {
func (o *OtpLogin) AccessState() process.State { return process.StateBasic } func (o *OtpLogin) AccessState() process.State { return process.StateBasic }
func (o *OtpLogin) Name() string { return "basic" } func (o *OtpLogin) Name() string { return "otp" }
func (o *OtpLogin) RenderTemplate(ctx authContext.FormContext) error { func (o *OtpLogin) RenderTemplate(ctx authContext.TemplateContext) error {
user := ctx.User() user := ctx.User()
if user == nil || user.Subject == "" { if user == nil || user.Subject == "" {
return fmt.Errorf("requires previous factor") return fmt.Errorf("requires previous factor")