Skip to content

Commit c5c1dcf

Browse files
committed
Make Dev login default for protonmail + add error message for invalid username/password
1 parent 80f3047 commit c5c1dcf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-protonmail

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ https://github.com/opulentfox-29/protonmail-api-client/blob/master/src/protonmai
103103
class SendMessageError(Exception):
104104
"""Error when trying to send message"""
105105

106+
class InvalidPassword(Exception):
107+
"""Invalid username or password"""
106108

107109
class InvalidTwoFactorCode(Exception):
108110
"""Invalid Two-Factor Authentication (2FA) code"""
@@ -1381,6 +1383,8 @@ class ProtonMail:
13811383
raise InvalidCaptcha(auth['Error'])
13821384
if auth["Code"] == 2028:
13831385
raise ConnectionRefusedError(f"Too many recent logins: {auth.get('Error')}")
1386+
if auth["Code"] == 8002:
1387+
raise InvalidPassword("Invalid username or password")
13841388

13851389
self.user.verify_session(b64decode(auth['ServerProof']))
13861390

@@ -1643,9 +1647,9 @@ else:
16431647

16441648
if "--authenticate" in sys.argv:
16451649
if "--alternate-auth" in sys.argv:
1646-
login_type = LoginType.DEV
1647-
else:
16481650
login_type = LoginType.WEB
1651+
else:
1652+
login_type = LoginType.DEV
16491653

16501654
username = input("Enter your Proton Mail username: ")
16511655
password = getpass.getpass("Enter your Proton Mail password: ")

0 commit comments

Comments
 (0)