allow selecting password or strong authentication
This commit is contained in:
parent
899cec0fdc
commit
9d3cc588f2
3 changed files with 23 additions and 13 deletions
|
|
@ -36,14 +36,21 @@ class CreditCooperatifBackend(BaseBackend, ICapBank):
|
||||||
VERSION = '0.d'
|
VERSION = '0.d'
|
||||||
DESCRIPTION = u'Credit Cooperatif French bank website'
|
DESCRIPTION = u'Credit Cooperatif French bank website'
|
||||||
LICENSE = 'AGPLv3+'
|
LICENSE = 'AGPLv3+'
|
||||||
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False),
|
auth_type = {"weak" : "Code confidentiel",
|
||||||
|
"strong": "Sesame"}
|
||||||
|
CONFIG = BackendConfig(Value('auth_type', label='Authentication type', choices=auth_type, default="strong"),
|
||||||
|
ValueBackendPassword('login', label='Account ID', masked=False),
|
||||||
ValueBackendPassword('pin', label='One time pin'))
|
ValueBackendPassword('pin', label='One time pin'))
|
||||||
|
|
||||||
BROWSER = CreditCooperatif
|
BROWSER = CreditCooperatif
|
||||||
|
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
|
print self.config['login'].get()
|
||||||
|
print self.config['auth_type'].get()
|
||||||
|
|
||||||
return self.create_browser(self.config['login'].get(),
|
return self.create_browser(self.config['login'].get(),
|
||||||
self.config['pin'].get())
|
self.config['pin'].get(),
|
||||||
|
self.config['auth_type'].get() == "strong")
|
||||||
|
|
||||||
def iter_accounts(self):
|
def iter_accounts(self):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,9 @@ class CreditCooperatif(BaseBrowser):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseBrowser.__init__(self, *args, **kwargs)
|
#catch and remove the third/last arg
|
||||||
self.token = None
|
self.strong_auth = args[-1]
|
||||||
|
BaseBrowser.__init__(self, *args[:-1], **kwargs)
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
self.location("/banque/sso/")
|
self.location("/banque/sso/")
|
||||||
|
|
@ -59,6 +60,7 @@ class CreditCooperatif(BaseBrowser):
|
||||||
|
|
||||||
assert isinstance(self.username, basestring)
|
assert isinstance(self.username, basestring)
|
||||||
assert isinstance(self.password, basestring)
|
assert isinstance(self.password, basestring)
|
||||||
|
assert isinstance(self.strong_auth, bool)
|
||||||
|
|
||||||
if self.is_logged():
|
if self.is_logged():
|
||||||
return
|
return
|
||||||
|
|
@ -66,23 +68,20 @@ class CreditCooperatif(BaseBrowser):
|
||||||
if not self.is_on_page(LoginPage):
|
if not self.is_on_page(LoginPage):
|
||||||
self.home()
|
self.home()
|
||||||
|
|
||||||
self.page.login(self.username, self.password)
|
self.page.login(self.username, self.password, self.strong_auth)
|
||||||
|
|
||||||
if not self.is_logged():
|
if not self.is_logged():
|
||||||
raise BrowserIncorrectPassword()
|
raise BrowserIncorrectPassword()
|
||||||
|
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
self.location(self.buildurl('/banque/cpt/incoopanetj2ee.do?ssomode=ok'))
|
self.location(self.buildurl('/banque/cpt/incoopanetj2ee.do?ssomode=ok'))
|
||||||
if self.page.is_error():
|
|
||||||
self.location(self.buildurl('/cyber/internet/StartTask.do', taskInfoOID='maSyntheseGratuite', token=self.token))
|
|
||||||
|
|
||||||
return self.page.get_list()
|
return self.page.get_list()
|
||||||
|
|
||||||
def get_account(self, id):
|
def get_account(self, id):
|
||||||
assert isinstance(id, basestring)
|
assert isinstance(id, basestring)
|
||||||
|
|
||||||
l = self.get_accounts_list()
|
for a in self.get_accounts_list():
|
||||||
for a in l:
|
|
||||||
if a.id == id:
|
if a.id == id:
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
@ -90,6 +89,7 @@ class CreditCooperatif(BaseBrowser):
|
||||||
|
|
||||||
def get_history(self, account):
|
def get_history(self, account):
|
||||||
self.location('/banque/cpt/cpt/situationcomptes.do?lnkReleveAction=X&numeroExterne='+ account.id)
|
self.location('/banque/cpt/cpt/situationcomptes.do?lnkReleveAction=X&numeroExterne='+ account.id)
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
assert self.is_on_page(TransactionsPage)
|
assert self.is_on_page(TransactionsPage)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,15 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage']
|
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage']
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
def login(self, login, pin):
|
def login(self, login, pin, strong_auth):
|
||||||
self.browser.select_form(name='loginCoForm', nr=1)
|
form_nb = 1 if strong_auth else 0
|
||||||
|
indentType = "RENFORCE" if strong_auth else "MDP"
|
||||||
|
|
||||||
|
self.browser.select_form(name='loginCoForm', nr=form_nb)
|
||||||
self.browser['codeUtil'] = login
|
self.browser['codeUtil'] = login
|
||||||
self.browser['motPasse'] = pin
|
self.browser['motPasse'] = pin
|
||||||
|
|
||||||
assert self.browser['identType'] == "RENFORCE"
|
assert self.browser['identType'] == indentType
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue