summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-10-02 12:04:55 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-10-02 12:04:55 -0300
commit5b07b72de0843fa1665bc5ef8da988fb112bc97c (patch)
tree6e65965ea7ecdd98a090a8149da8258ee5a35fd6 /src
parent10c1eadc76b5c903feac32a6e2d113034d05cee0 (diff)
parentd74a4c3840c95e5879c89ec9d1f6d48ab54b0f55 (diff)
Merge remote-tracking branch 'chiiph/bug/login_errors' into develop
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/crypto/srpauth.py20
-rw-r--r--src/leap/bitmask/crypto/tests/test_srpauth.py6
-rw-r--r--src/leap/bitmask/gui/preferenceswindow.py5
3 files changed, 11 insertions, 20 deletions
diff --git a/src/leap/bitmask/crypto/srpauth.py b/src/leap/bitmask/crypto/srpauth.py
index bf85f75c..9c08d353 100644
--- a/src/leap/bitmask/crypto/srpauth.py
+++ b/src/leap/bitmask/crypto/srpauth.py
@@ -52,13 +52,6 @@ class SRPAuthConnectionError(SRPAuthenticationError):
pass
-class SRPAuthUnknownUser(SRPAuthenticationError):
- """
- Exception raised when trying to authenticate an unknown user
- """
- pass
-
-
class SRPAuthBadStatusCode(SRPAuthenticationError):
"""
Exception raised when we received an unknown bad status code
@@ -97,7 +90,7 @@ class SRPAuthJSONDecodeError(SRPAuthenticationError):
pass
-class SRPAuthBadPassword(SRPAuthenticationError):
+class SRPAuthBadUserOrPassword(SRPAuthenticationError):
"""
Exception raised when the user provided a bad password to auth.
"""
@@ -219,7 +212,6 @@ class SRPAuth(QtCore.QObject):
Might raise all SRPAuthenticationError based:
SRPAuthenticationError
SRPAuthConnectionError
- SRPAuthUnknownUser
SRPAuthBadStatusCode
SRPAuthNoSalt
SRPAuthNoB
@@ -266,7 +258,7 @@ class SRPAuth(QtCore.QObject):
"Status code = %r. Content: %r" %
(init_session.status_code, content))
if init_session.status_code == 422:
- raise SRPAuthUnknownUser(self._WRONG_USER_PASS)
+ raise SRPAuthBadUserOrPassword(self._WRONG_USER_PASS)
raise SRPAuthBadStatusCode(self.tr("There was a problem with"
" authentication"))
@@ -296,7 +288,7 @@ class SRPAuth(QtCore.QObject):
SRPAuthBadDataFromServer
SRPAuthConnectionError
SRPAuthJSONDecodeError
- SRPAuthBadPassword
+ SRPAuthBadUserOrPassword
:param salt_B: salt and B parameters for the username
:type salt_B: tuple
@@ -355,7 +347,7 @@ class SRPAuth(QtCore.QObject):
"received: %s", (content,))
logger.error("[%s] Wrong password (HAMK): [%s]" %
(auth_result.status_code, error))
- raise SRPAuthBadPassword(self._WRONG_USER_PASS)
+ raise SRPAuthBadUserOrPassword(self._WRONG_USER_PASS)
if auth_result.status_code not in (200,):
logger.error("No valid response (HAMK): "
@@ -452,7 +444,7 @@ class SRPAuth(QtCore.QObject):
It requires to be authenticated.
Might raise:
- SRPAuthBadPassword
+ SRPAuthBadUserOrPassword
requests.exceptions.HTTPError
:param current_password: the current password for the logged user.
@@ -463,7 +455,7 @@ class SRPAuth(QtCore.QObject):
leap_assert(self.get_uid() is not None)
if current_password != self._password:
- raise SRPAuthBadPassword
+ raise SRPAuthBadUserOrPassword
url = "%s/%s/users/%s.json" % (
self._provider_config.get_api_uri(),
diff --git a/src/leap/bitmask/crypto/tests/test_srpauth.py b/src/leap/bitmask/crypto/tests/test_srpauth.py
index 6fb2b739..0cb8e79a 100644
--- a/src/leap/bitmask/crypto/tests/test_srpauth.py
+++ b/src/leap/bitmask/crypto/tests/test_srpauth.py
@@ -246,7 +246,7 @@ class SRPAuthTestCase(unittest.TestCase):
d = self._prepare_auth_test(422)
def wrapper(_):
- with self.assertRaises(srpauth.SRPAuthUnknownUser):
+ with self.assertRaises(srpauth.SRPAuthBadUserOrPassword):
with mock.patch(
'leap.bitmask.util.request_helpers.get_content',
new=mock.create_autospec(get_content)) as content:
@@ -425,7 +425,7 @@ class SRPAuthTestCase(unittest.TestCase):
new=mock.create_autospec(get_content)) as \
content:
content.return_value = ("", 0)
- with self.assertRaises(srpauth.SRPAuthBadPassword):
+ with self.assertRaises(srpauth.SRPAuthBadUserOrPassword):
self.auth_backend._process_challenge(
salt_B,
username=self.TEST_USER)
@@ -449,7 +449,7 @@ class SRPAuthTestCase(unittest.TestCase):
new=mock.create_autospec(get_content)) as \
content:
content.return_value = ("[]", 0)
- with self.assertRaises(srpauth.SRPAuthBadPassword):
+ with self.assertRaises(srpauth.SRPAuthBadUserOrPassword):
self.auth_backend._process_challenge(
salt_B,
username=self.TEST_USER)
diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py
index 7e281b44..58cb05ba 100644
--- a/src/leap/bitmask/gui/preferenceswindow.py
+++ b/src/leap/bitmask/gui/preferenceswindow.py
@@ -27,11 +27,10 @@ from PySide import QtCore, QtGui
from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.gui.ui_preferences import Ui_Preferences
from leap.soledad.client import NoStorageSecret
-from leap.bitmask.crypto.srpauth import SRPAuthBadPassword
+from leap.bitmask.crypto.srpauth import SRPAuthBadUserOrPassword
from leap.bitmask.util.password import basic_password_checks
from leap.bitmask.services import get_supported
from leap.bitmask.config.providerconfig import ProviderConfig
-from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector
from leap.bitmask.services import get_service_display_name
logger = logging.getLogger(__name__)
@@ -179,7 +178,7 @@ class PreferencesWindow(QtGui.QDialog):
logger.error("Error changing password: %s", (failure, ))
problem = self.tr("There was a problem changing the password.")
- if failure.check(SRPAuthBadPassword):
+ if failure.check(SRPAuthBadUserOrPassword):
problem = self.tr("You did not enter a correct current password.")
self._set_password_change_status(problem, error=True)