mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
76_SMAPortal: contrib 3.1.2
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@22272 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bc89f4bb4f
commit
b7e9d40f2b
@ -1020,7 +1020,7 @@ sub _doLogin {
|
|||||||
$retcode = $loginp->code;
|
$retcode = $loginp->code;
|
||||||
$location = $loginp->header('Location') // "";
|
$location = $loginp->header('Location') // "";
|
||||||
|
|
||||||
if(!__isLoggedIn ($username,$loginp)) { # keine aktive Session -> neuer Login
|
if(!__isLoggedIn ($name,$username,$loginp)) { # keine aktive Session -> neuer Login
|
||||||
Log3 ($name, 4, "$name - User not logged in. Try login with credentials ...");
|
Log3 ($name, 4, "$name - User not logged in. Try login with credentials ...");
|
||||||
|
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
@ -1048,10 +1048,8 @@ sub _doLogin {
|
|||||||
my ($logname) = $sc =~ /SunnyPortalLoginInfo=Username=(.*?)&/sx;
|
my ($logname) = $sc =~ /SunnyPortalLoginInfo=Username=(.*?)&/sx;
|
||||||
Log3 ($name, 5, "$name - Header Set-Cookie: ".$sc) if($v5d =~ /loginData/);
|
Log3 ($name, 5, "$name - Header Set-Cookie: ".$sc) if($v5d =~ /loginData/);
|
||||||
|
|
||||||
if(__isLoggedIn ($username,$loginp)) { # Login erfolgeich(Landing Pages können im Portal eingestellt werden!)
|
if(__isLoggedIn ($username,$loginp,$name)) { # Login erfolgeich(Landing Pages können im Portal eingestellt werden!)
|
||||||
Log3 ($name, 3, "$name - Login into SMA-Portal successfully done with user: $logname");
|
|
||||||
handleCounter ($name, "dailyIssueCookieCounter"); # Cookie Ausstellungszähler setzen
|
handleCounter ($name, "dailyIssueCookieCounter"); # Cookie Ausstellungszähler setzen
|
||||||
|
|
||||||
BlockingInformParent("FHEM::SMAPortal::setFromBlocking", [$name, "loginState:successful", "oldlogintime:".(gettimeofday())[0] ], 1);
|
BlockingInformParent("FHEM::SMAPortal::setFromBlocking", [$name, "loginState:successful", "oldlogintime:".(gettimeofday())[0] ], 1);
|
||||||
$errstate = 0;
|
$errstate = 0;
|
||||||
|
|
||||||
@ -1067,10 +1065,13 @@ sub _doLogin {
|
|||||||
} elsif ($loginp->is_redirect) {
|
} elsif ($loginp->is_redirect) {
|
||||||
$retcode = $loginp->code;
|
$retcode = $loginp->code;
|
||||||
$location = $loginp->header('Location') // "";
|
$location = $loginp->header('Location') // "";
|
||||||
|
Log3 ($name, 3, "$name - User is already logged in.");
|
||||||
|
|
||||||
if($v5d =~ /loginData/) {
|
if($v5d =~ /loginData/) {
|
||||||
Log3 ($name, 5, "$name - Redirect return code: ". $retcode );
|
Log3 ($name, 5, "$name - Redirect return code: ". $retcode );
|
||||||
Log3 ($name, 5, "$name - Redirect Header Location: ".$location);
|
Log3 ($name, 5, "$name - Redirect Header Location: ".$location);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockingInformParent("FHEM::SMAPortal::setFromBlocking", [$name, "loginState:successful", "NULL" ], 1);
|
BlockingInformParent("FHEM::SMAPortal::setFromBlocking", [$name, "loginState:successful", "NULL" ], 1);
|
||||||
$errstate = 0;
|
$errstate = 0;
|
||||||
|
|
||||||
@ -1091,6 +1092,7 @@ return ($state, $errstate);
|
|||||||
# Login Status testen
|
# Login Status testen
|
||||||
################################################################
|
################################################################
|
||||||
sub __isLoggedIn {
|
sub __isLoggedIn {
|
||||||
|
my $name = shift;
|
||||||
my $username = shift;
|
my $username = shift;
|
||||||
my $loginp = shift;
|
my $loginp = shift;
|
||||||
|
|
||||||
@ -1098,6 +1100,7 @@ sub __isLoggedIn {
|
|||||||
my ($logname) = $sc =~ /SunnyPortalLoginInfo=Username=(.*?)&/sx;
|
my ($logname) = $sc =~ /SunnyPortalLoginInfo=Username=(.*?)&/sx;
|
||||||
|
|
||||||
if($logname && $logname eq $username) {
|
if($logname && $logname eq $username) {
|
||||||
|
Log3 ($name, 3, "$name - Login into SMA-Portal successfully done with user: $logname");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user