fix(login): illogical conditional
This commit is contained in:
parent
cac1be906c
commit
9c9815544f
1 changed files with 16 additions and 13 deletions
|
|
@ -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 == "" {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue