Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

MFA input validation #139

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/okta.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,19 @@ func (o *OktaClient) selectMFADevice() (*OktaUserAuthnFactor, error) {
log.Infof("%d: %s (%s)", i, f.Provider, f.FactorType)
}
i, err := Prompt("Select MFA method", false)
if i == "" {
return nil, errors.New("Invalid selection - Please use an option that is listed")
}
if err != nil {
return nil, err
}
factorIdx, err := strconv.Atoi(i)
if err != nil {
return nil, err
}
if factorIdx > (len(factors) - 1) {
return nil, errors.New("Invalid selection - Please use an option that is listed")
}
return &factors[factorIdx], nil
}

Expand Down