fix: MFA form not set as application root (#170)

Closes #158
This commit is contained in:
ayntgl 2022-08-12 14:08:20 +05:30 • committed by GitHub
parent aefe7ac4c2
commit 73e7eecd81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

13
main.go
View file

@ -88,7 +88,7 @@ func main() {
// The account has MFA enabled, reattempt login with MFA code and ticket.
mfaLoginForm := ui.NewLoginForm(true)
mfaLoginForm.AddButton("Login", func() {
code := loginForm.GetFormItem(0).(*tview.InputField).GetText()
code := mfaLoginForm.GetFormItem(0).(*tview.InputField).GetText()
if code == "" {
return
}
@ -109,6 +109,8 @@ func main() {
go keyring.Set(name, "token", lr.Token)
})
app.SetRoot(mfaLoginForm, true)
}
})
@ -132,16 +134,11 @@ func main() {
tview.Styles.BorderColor = tcell.GetColor(app.Config.Theme.Border)
tview.Styles.TitleColor = tcell.GetColor(app.Config.Theme.Title)
err = app.Run()
if err != nil {
panic(err)
}
return nil
return app.Run()
}
err := cliApp.Run(os.Args)
if err != nil {
panic(err)
log.Fatal(err)
}
}

View file

@ -12,7 +12,7 @@ func NewLoginForm(mfa bool) *LoginForm {
}
if mfa {
lf.AddPasswordField("MFA Code (optional)", "", 0, 0, nil)
lf.AddPasswordField("Authentication/Backup Code", "", 0, 0, nil)
} else {
lf.
AddInputField("Email", "", 0, nil, nil).