fix(login): illogical conditional

This commit is contained in:
ayn2op 2025-12-09 01:25:09 -05:00
parent cac1be906c
commit 9c9815544f

View file

@ -70,22 +70,25 @@ func (f *Form) login() {
return
}
if resp.MFA && resp.TOTP {
code := f.form.GetFormItem(2).(*tview.InputField).GetText()
if code == "" {
f.onError(errors.New("code required"))
return
}
if resp.MFA {
switch {
case resp.TOTP:
code := f.form.GetFormItem(2).(*tview.InputField).GetText()
if code == "" {
f.onError(errors.New("code required"))
return
}
// Attempt to login using the code.
resp, err = client.TOTP(code, resp.Ticket)
if err != nil {
f.onError(err)
// Attempt to login using the code.
resp, err = client.TOTP(code, resp.Ticket)
if err != nil {
f.onError(err)
return
}
default:
f.onError(errors.New("unsupported mfa type"))
return
}
} else {
f.onError(errors.New("unsupported mfa type"))
return
}
if resp.Token == "" {