Skip to content

Commit

Permalink
Add an error message if more than one mfa device is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gilmer committed Jun 30, 2020
1 parent 40b5277 commit 243655c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ func (u *User) GetMFADevice(logger *log.Logger) error {
if len(mfaDeviceOutput.MFADevices) == 0 {
return errors.New("no MFA devices registered")
}
if len(mfaDeviceOutput.MFADevices) > 1 {
return errors.New("more than one MFA device registered, no way to choose")
}
mfaDevice := mfaDeviceOutput.MFADevices[0]

u.BaseProfile.MFASerial = *mfaDevice.SerialNumber
Expand Down

0 comments on commit 243655c

Please sign in to comment.