lcl[ent]: Proper handling of login failure
This commit is contained in:
parent
af824fde0f
commit
34d2ac007b
1 changed files with 11 additions and 5 deletions
|
|
@ -63,9 +63,11 @@ class LCLEnterpriseBrowser(BaseBrowser):
|
||||||
self.logout()
|
self.logout()
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
|
if self.page:
|
||||||
ID_XPATH = '//div[@id="headerIdentite"]'
|
ID_XPATH = '//div[@id="headerIdentite"]'
|
||||||
self._logged = bool(self.page.document.xpath(ID_XPATH))
|
self._logged = bool(self.page.document.xpath(ID_XPATH))
|
||||||
return self._logged
|
return self._logged
|
||||||
|
return False
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
assert isinstance(self.username, basestring)
|
assert isinstance(self.username, basestring)
|
||||||
|
|
@ -79,7 +81,11 @@ class LCLEnterpriseBrowser(BaseBrowser):
|
||||||
if self.is_on_page(AlreadyConnectedPage):
|
if self.is_on_page(AlreadyConnectedPage):
|
||||||
raise BrowserIncorrectPassword("Another session is already open. Please try again later.")
|
raise BrowserIncorrectPassword("Another session is already open. Please try again later.")
|
||||||
if not self.is_logged():
|
if not self.is_logged():
|
||||||
raise BrowserIncorrectPassword("invalid login/password.\nIf you did not change anything, be sure to check for password renewal request\non the original web site.\nAutomatic renewal will be implemented later.")
|
raise BrowserIncorrectPassword(
|
||||||
|
"Invalid login/password.\n"
|
||||||
|
"If you did not change anything, be sure to check for password renewal request\n"
|
||||||
|
"on the original website.\n"
|
||||||
|
"Automatic renewal will be implemented later.")
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
self.location(self.PAGES_REV[LogoutPage], no_login=True)
|
self.location(self.PAGES_REV[LogoutPage], no_login=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue