mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
Other: Bump GPA to v0.3.0
This commit is contained in:
@ -367,7 +367,7 @@ func (bridge *Bridge) loadUsers(ctx context.Context) error {
|
||||
func (bridge *Bridge) loadUser(ctx context.Context, user *vault.User) error {
|
||||
client, auth, err := bridge.api.NewClientWithRefresh(ctx, user.AuthUID(), user.AuthRef())
|
||||
if err != nil {
|
||||
if apiErr := new(proton.Error); errors.As(err, &apiErr) && (apiErr.Code == proton.AuthRefreshTokenInvalid) {
|
||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) && (apiErr.Code == proton.AuthRefreshTokenInvalid) {
|
||||
// The session cannot be refreshed, we sign out the user by clearing his auth secrets.
|
||||
if err := user.Clear(); err != nil {
|
||||
logrus.WithError(err).Warn("Failed to clear user secrets")
|
||||
|
||||
@ -405,7 +405,7 @@ func (s *Service) Login(ctx context.Context, login *LoginRequest) (*emptypb.Empt
|
||||
|
||||
if errors.Is(err, bridge.ErrUserAlreadyLoggedIn) {
|
||||
_ = s.SendEvent(NewLoginAlreadyLoggedInEvent(auth.UserID))
|
||||
} else if apiErr := new(proton.Error); errors.As(err, &apiErr) {
|
||||
} else if apiErr := new(proton.APIError); errors.As(err, &apiErr) {
|
||||
switch apiErr.Code { // nolint:exhaustive
|
||||
case proton.PasswordWrong, proton.UsernameInvalid:
|
||||
_ = s.SendEvent(NewLoginError(LoginErrorType_USERNAME_PASSWORD_ERROR, ""))
|
||||
@ -464,7 +464,7 @@ func (s *Service) Login2FA(ctx context.Context, login *LoginRequest) (*emptypb.E
|
||||
}
|
||||
|
||||
if err := s.authClient.Auth2FA(context.Background(), proton.Auth2FAReq{TwoFactorCode: string(twoFA)}); err != nil {
|
||||
if apiErr := new(proton.Error); errors.As(err, &apiErr) && apiErr.Code == proton.PasswordWrong {
|
||||
if apiErr := new(proton.APIError); errors.As(err, &apiErr) && apiErr.Code == proton.PasswordWrong {
|
||||
s.log.Warn("Login 2FA: retry 2fa")
|
||||
_ = s.SendEvent(NewLoginError(LoginErrorType_TFA_ERROR, ""))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user