lcl: support new auth system
This commit is contained in:
parent
62ef400de8
commit
bb430b3078
3 changed files with 17 additions and 8 deletions
|
|
@ -39,7 +39,7 @@ class LCLBackend(BaseBackend, ICapBank):
|
||||||
LICENSE = 'AGPLv3+'
|
LICENSE = 'AGPLv3+'
|
||||||
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', regexp='^\d+\w$', masked=False),
|
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', regexp='^\d+\w$', masked=False),
|
||||||
ValueBackendPassword('password', label='Password of account', regexp='^\d{6}$'),
|
ValueBackendPassword('password', label='Password of account', regexp='^\d{6}$'),
|
||||||
Value('agency', label='Agency code', regexp='^\d{3,4}$'))
|
Value('agency', label='Agency code (deprecated)', regexp='^(\d{3,4}|)$', default=''))
|
||||||
BROWSER = LCLBrowser
|
BROWSER = LCLBrowser
|
||||||
|
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class LCLBrowser(BaseBrowser):
|
||||||
'https://particuliers.secure.lcl.fr/outil/UAUT/Authentication/authenticate': LoginPage,
|
'https://particuliers.secure.lcl.fr/outil/UAUT/Authentication/authenticate': LoginPage,
|
||||||
'https://particuliers.secure.lcl.fr/outil/UAUT\?from=.*': LoginPage,
|
'https://particuliers.secure.lcl.fr/outil/UAUT\?from=.*': LoginPage,
|
||||||
'https://particuliers.secure.lcl.fr/outil/UAUT/Accueil/preRoutageLogin': LoginPage,
|
'https://particuliers.secure.lcl.fr/outil/UAUT/Accueil/preRoutageLogin': LoginPage,
|
||||||
|
'https://particuliers.secure.lcl.fr//outil/UAUT/Contract/routing': LoginPage,
|
||||||
'https://particuliers.secure.lcl.fr/outil/UAUT/Contrat/choixContrat.*': ContractsPage,
|
'https://particuliers.secure.lcl.fr/outil/UAUT/Contrat/choixContrat.*': ContractsPage,
|
||||||
'https://particuliers.secure.lcl.fr/outil/UWSP/Synthese': AccountsPage,
|
'https://particuliers.secure.lcl.fr/outil/UWSP/Synthese': AccountsPage,
|
||||||
'https://particuliers.secure.lcl.fr/outil/UWLM/ListeMouvements.*/accesListeMouvements.*': AccountHistoryPage,
|
'https://particuliers.secure.lcl.fr/outil/UWLM/ListeMouvements.*/accesListeMouvements.*': AccountHistoryPage,
|
||||||
|
|
@ -60,16 +61,13 @@ class LCLBrowser(BaseBrowser):
|
||||||
assert isinstance(self.username, basestring)
|
assert isinstance(self.username, basestring)
|
||||||
assert isinstance(self.password, basestring)
|
assert isinstance(self.password, basestring)
|
||||||
assert self.password.isdigit()
|
assert self.password.isdigit()
|
||||||
assert isinstance(self.agency, basestring)
|
|
||||||
assert self.agency.isdigit()
|
|
||||||
|
|
||||||
if not self.is_on_page(LoginPage):
|
if not self.is_on_page(LoginPage):
|
||||||
self.location('%s://%s/outil/UAUT/Authentication/authenticate'
|
self.location('%s://%s/outil/UAUT/Authentication/authenticate'
|
||||||
% (self.PROTOCOL, self.DOMAIN),
|
% (self.PROTOCOL, self.DOMAIN),
|
||||||
no_login=True)
|
no_login=True)
|
||||||
|
|
||||||
if not self.page.login(self.agency, self.username, self.password) or \
|
if not self.page.login(self.username, self.password, self.agency) or \
|
||||||
not self.is_logged() or \
|
|
||||||
(self.is_on_page(LoginPage) and self.page.is_error()) :
|
(self.is_on_page(LoginPage) and self.page.is_error()) :
|
||||||
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.\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.")
|
||||||
self.location('%s://%s/outil/UWSP/Synthese'
|
self.location('%s://%s/outil/UWSP/Synthese'
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,21 @@ class SkipPage(BasePage):
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
|
def on_loaded(self):
|
||||||
|
try:
|
||||||
|
self.browser.select_form(name='form')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
def myXOR(self,value,seed):
|
def myXOR(self,value,seed):
|
||||||
s=''
|
s=''
|
||||||
for i in xrange(len(value)):
|
for i in xrange(len(value)):
|
||||||
s+=chr(seed^ord(value[i]))
|
s+=chr(seed^ord(value[i]))
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def login(self, agency, login, passwd):
|
def login(self, login, passwd, agency):
|
||||||
try:
|
try:
|
||||||
vk=LCLVirtKeyboard(self)
|
vk=LCLVirtKeyboard(self)
|
||||||
except VirtKeyboardError,err:
|
except VirtKeyboardError,err:
|
||||||
|
|
@ -106,8 +114,11 @@ class LoginPage(BasePage):
|
||||||
self.browser.select_form(
|
self.browser.select_form(
|
||||||
predicate=lambda x: x.attrs.get('id','')=='formAuthenticate')
|
predicate=lambda x: x.attrs.get('id','')=='formAuthenticate')
|
||||||
self.browser.form.set_all_readonly(False)
|
self.browser.form.set_all_readonly(False)
|
||||||
self.browser['agenceId'] = agency
|
if len(agency) > 0:
|
||||||
self.browser['compteId'] = login
|
self.browser['agenceId'] = agency.encode('utf-8')
|
||||||
|
self.browser['compteId'] = login.encode('utf-8')
|
||||||
|
else:
|
||||||
|
self.browser['identifiant'] = login.encode('utf-8')
|
||||||
self.browser['postClavierXor'] = base64.b64encode(self.myXOR(password,seed))
|
self.browser['postClavierXor'] = base64.b64encode(self.myXOR(password,seed))
|
||||||
try:
|
try:
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue