mirror of
https://github.com/1f349/lavender.git
synced 2025-04-15 23:37:53 +01:00
Fix OTP form implementation
This commit is contained in:
parent
900c220a84
commit
49cf77d681
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user