Mise à jour de l'authentification
This commit is contained in:
parent
952cf74b8e
commit
f5e8e4bdf0
20
homesfr.py
20
homesfr.py
|
@ -21,7 +21,7 @@ authors = (
|
||||||
'Gilles "Almtesh" Émilien MOREL',
|
'Gilles "Almtesh" Émilien MOREL',
|
||||||
)
|
)
|
||||||
name = 'homesfr for Python 3'
|
name = 'homesfr for Python 3'
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
|
|
||||||
# Settable modes
|
# Settable modes
|
||||||
MODE_OFF = 0
|
MODE_OFF = 0
|
||||||
|
@ -51,12 +51,12 @@ class Common ():
|
||||||
|
|
||||||
# path to login test
|
# path to login test
|
||||||
self.auth_path = '/mysensors'
|
self.auth_path = '/mysensors'
|
||||||
self.auth_ok = '/accueil' # if logged
|
self.auth_ok_url = 'https://home.sfr.fr/logged' # if logged
|
||||||
self.auth_post_url = 'https://cas.home.sfr.fr/authentification'
|
self.auth_post_url = 'https://boutique.home.sfr.fr/authentification'
|
||||||
self.auth_referer = 'https://cas.home.sfr.fr/authentification'
|
self.auth_referer = 'https://boutique.home.sfr.fr/authentification?back=service'
|
||||||
self.auth_user_field = 'username'
|
self.auth_user_field = 'email'
|
||||||
self.auth_pass_field = 'password'
|
self.auth_pass_field = 'passwd'
|
||||||
self.auth_extra_fields = {}
|
self.auth_extra_fields = {'back': 'service', 'token_sso': '', 'error_sso': '', 'SubmitLogin': 'OK'}
|
||||||
self.auth_logout_path = '/deconnexion'
|
self.auth_logout_path = '/deconnexion'
|
||||||
|
|
||||||
# Path to sensors and mode
|
# Path to sensors and mode
|
||||||
|
@ -251,7 +251,7 @@ class HomeSFR (Common):
|
||||||
a = self.opener.open (self.auth_post_url, data = data)
|
a = self.opener.open (self.auth_post_url, data = data)
|
||||||
if self.DEBUG:
|
if self.DEBUG:
|
||||||
print ('Auth redirected to ' + a.geturl ())
|
print ('Auth redirected to ' + a.geturl ())
|
||||||
return (a.geturl () == self.base_url + self.auth_ok)
|
return (a.geturl () == self.auth_ok_url)
|
||||||
else:
|
else:
|
||||||
return (False)
|
return (False)
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ class HomeSFR (Common):
|
||||||
'''
|
'''
|
||||||
Trigger the autologin
|
Trigger the autologin
|
||||||
'''
|
'''
|
||||||
if (self.autologin and not self.test_login ()):
|
while (self.autologin and not self.test_login ()):
|
||||||
self.login ()
|
self.login ()
|
||||||
|
|
||||||
def logout (self):
|
def logout (self):
|
||||||
|
@ -364,8 +364,6 @@ class HomeSFR (Common):
|
||||||
Get a Camera object from the sensor's id
|
Get a Camera object from the sensor's id
|
||||||
'''
|
'''
|
||||||
self.do_autologin ()
|
self.do_autologin ()
|
||||||
if (self.autologin and not self.test_login ()):
|
|
||||||
self.login ()
|
|
||||||
r = Camera (id, self.opener)
|
r = Camera (id, self.opener)
|
||||||
r.refresh ()
|
r.refresh ()
|
||||||
return (r)
|
return (r)
|
||||||
|
|
Loading…
Reference in New Issue