forked from Silverfish/proton-bridge
GODT-2180: Allow login with FIDO2
The API docs didn't specify what the "integer" meant. Turns out it's a bitfield; we can't compare with equality.
This commit is contained in:
@ -182,7 +182,7 @@ func (bridge *Bridge) LoginFull(
|
||||
return "", fmt.Errorf("failed to begin login process: %w", err)
|
||||
}
|
||||
|
||||
if auth.TwoFA.Enabled == proton.TOTPEnabled {
|
||||
if auth.TwoFA.Enabled&proton.TOTPEnabled != 0 {
|
||||
logrus.WithField("userID", auth.UserID).Info("Requesting TOTP")
|
||||
|
||||
totp, err := getTOTP()
|
||||
|
||||
@ -149,7 +149,7 @@ func (f *frontendCLI) loginAccount(c *ishell.Context) { //nolint:funlen
|
||||
return
|
||||
}
|
||||
|
||||
if auth.TwoFA.Enabled == proton.TOTPEnabled {
|
||||
if auth.TwoFA.Enabled&proton.TOTPEnabled != 0 {
|
||||
code := f.readStringInAttempts("Two factor code", c.ReadLine, isNotEmpty)
|
||||
if code == "" {
|
||||
f.printAndLogError("Cannot login: need two factor code")
|
||||
|
||||
@ -406,7 +406,7 @@ func (s *Service) Login(ctx context.Context, login *LoginRequest) (*emptypb.Empt
|
||||
s.auth = auth
|
||||
|
||||
switch {
|
||||
case auth.TwoFA.Enabled == proton.TOTPEnabled:
|
||||
case auth.TwoFA.Enabled&proton.TOTPEnabled != 0:
|
||||
_ = s.SendEvent(NewLoginTfaRequestedEvent(login.Username))
|
||||
|
||||
case auth.PasswordMode == proton.TwoPasswordMode:
|
||||
|
||||
Reference in New Issue
Block a user