Przeglądaj źródła

Fix screen size and timezone lost on oauth2 login

Laurent Destailleur 1 rok temu
rodzic
commit
4c91518f59

+ 6 - 6
htdocs/core/login/functions_googleoauth.php

@@ -56,12 +56,12 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto
 				'entity'=>GETPOST('entity', 'int'),
 				'backtopage'=>GETPOST('backtopage'),
 				'tz'=>GETPOST('tz'),
-				'tzstring'=>GETPOST('tzstring'),
+				'tz_string'=>GETPOST('tz_string'),
 				'dst_observed'=>GETPOST('dst_observed'),
 				'dst_first'=>GETPOST('dst_first'),
 				'dst_second'=>GETPOST('dst_second'),
-				'screenwidth'=>GETPOST('screenwidth'),
-				'screenheight'=>GETPOST('screenheight'),
+				'dol_screenwidth'=>GETPOST('screenwidth'),
+				'dol_screenheight'=>GETPOST('screenheight'),
 				'dol_hide_topmenu'=>GETPOST('dol_hide_topmenu'),
 				'dol_hide_leftmenu'=>GETPOST('dol_hide_leftmenu'),
 				'dol_optimize_smallscreen'=>GETPOST('dol_optimize_smallscreen'),
@@ -100,12 +100,12 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto
 				$_POST['entity'] = $tmparray['entity'];
 				$_POST['backtopage'] = $tmparray['backtopage'];
 				$_POST['tz'] = $tmparray['tz'];
-				$_POST['tzstring'] = $tmparray['tzstring'];
+				$_POST['tz_string'] = $tmparray['tz_string'];
 				$_POST['dst_observed'] = $tmparray['dst_observed'];
 				$_POST['dst_first'] = $tmparray['dst_first'];
 				$_POST['dst_second'] = $tmparray['dst_second'];
-				$_POST['screenwidth'] = $tmparray['screenwidth'];
-				$_POST['screenwidth'] = $tmparray['screenwidth'];
+				$_POST['screenwidth'] = $tmparray['dol_screenwidth'];
+				$_POST['screenheight'] = $tmparray['dol_screenheight'];
 				$_POST['dol_hide_topmenu'] = $tmparray['dol_hide_topmenu'];
 				$_POST['dol_hide_leftmenu'] = $tmparray['dol_hide_leftmenu'];
 				$_POST['dol_optimize_smallscreen'] = $tmparray['dol_optimize_smallscreen'];

+ 1 - 1
htdocs/core/modules/oauth/google_oauthcallback.php

@@ -162,7 +162,7 @@ if (!GETPOST('code')) {
 	$_SESSION['oauthstateanticsrf'] = $state;
 
 	// Save more data into session
-	// Not required. All data are savec into $_SESSION['datafromloginform'] when form is posted with a click on Login with
+	// Not required. All data are saved into $_SESSION['datafromloginform'] when form is posted with a click on Login with
 	// Google with param actionlogin=login and beforeoauthloginredirect=1, by the functions_googleoauth.php.
 	/*
 	if (!empty($_POST["tz"])) {

+ 3 - 1
htdocs/main.inc.php

@@ -845,7 +845,9 @@ if (!defined('NOLOGIN')) {
 						$dol_dst = 1;
 					}
 				}
-				//print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit;
+				$dol_screenheight = empty($_POST["screenheight"]) ? (empty($_SESSION["dol_screenheight"]) ? '' : $_SESSION["dol_screenheight"]) : $_POST["screenheight"];
+				$dol_screenwidth = empty($_POST["screenwidth"]) ? (empty($_SESSION["dol_screenwidth"]) ? '' : $_SESSION["dol_screenwidth"]) : $_POST["screenwidth"];
+				//print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst.'-'.sdol_screenheight.'-'.sdol_screenwidth; exit;
 			}
 
 			if (!$login) {