if password if expired, switch with the value of the new 'rotating_password' backend setting
This commit is contained in:
parent
7840a165e4
commit
a4dbaf01c5
6 changed files with 122 additions and 6 deletions
|
|
@ -19,9 +19,9 @@
|
|||
from .accounts_list import AccountsList
|
||||
from .account_coming import AccountComing
|
||||
from .account_history import AccountHistory
|
||||
from .login import LoginPage, ConfirmPage
|
||||
from .login import LoginPage, ConfirmPage, ChangePasswordPage
|
||||
|
||||
class AccountPrelevement(AccountsList): pass
|
||||
|
||||
__all__ = ['AccountsList', 'AccountComing', 'AccountHistory', 'LoginPage',
|
||||
'ConfirmPage', 'AccountPrelevement']
|
||||
'ConfirmPage', 'AccountPrelevement', 'ChangePasswordPage']
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import re
|
|||
from weboob.capabilities.bank import Account
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
from ..errors import PasswordExpired
|
||||
|
||||
class AccountsList(BasePage):
|
||||
LINKID_REGEXP = re.compile(".*ch4=(\w+).*")
|
||||
|
||||
|
|
@ -59,4 +61,11 @@ class AccountsList(BasePage):
|
|||
account.coming = float(coming)
|
||||
|
||||
l.append(account)
|
||||
|
||||
if len(l) == 0:
|
||||
# oops, no accounts? check if we have not exhausted the allowed use
|
||||
# of this password
|
||||
for div in self.document.getroot().cssselect('div.Style_texte_gras'):
|
||||
if div.text.strip() == 'Vous avez atteint la date de fin de vie de votre code secret.':
|
||||
raise PasswordExpired(div.text.strip())
|
||||
return l
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
|
||||
from weboob.tools.mech import ClientForm
|
||||
import sys
|
||||
import urllib
|
||||
from logging import error
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.backends.bnporc.captcha import Captcha, TileError
|
||||
|
||||
|
||||
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
|
@ -32,7 +38,7 @@ class LoginPage(BasePage):
|
|||
try:
|
||||
img.build_tiles()
|
||||
except TileError, err:
|
||||
print >>sys.stderr, "Error: %s" % err
|
||||
error("Error: %s" % err)
|
||||
if err.tile:
|
||||
err.tile.display()
|
||||
|
||||
|
|
@ -47,3 +53,24 @@ class LoginPage(BasePage):
|
|||
|
||||
class ConfirmPage(BasePage):
|
||||
pass
|
||||
|
||||
class ChangePasswordPage(BasePage):
|
||||
def change_password(self, current, new):
|
||||
img = Captcha(self.browser.openurl('/NSImgGrille'))
|
||||
|
||||
try:
|
||||
img.build_tiles()
|
||||
except TileError, err:
|
||||
error('Error: %s' % err)
|
||||
if err.tile:
|
||||
err.tile.display()
|
||||
|
||||
code_current = img.get_codes(current)
|
||||
code_new = img.get_codes(new)
|
||||
|
||||
data = {'ch1': code_current,
|
||||
'ch2': code_new,
|
||||
'ch3': code_new
|
||||
}
|
||||
|
||||
self.browser.location('/SAF_CHM_VALID', urllib.urlencode(data))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue