Commit 44afb84b493fe89598c1c5b4ced0e37601c600bf
1 parent
e01f0872
Exists in
master
and in
7 other branches
Allow empty first_name, last_name and email for createUser function + increase timestamp test
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
src/DDSERVICES/SOAP/DDserverWeb.php
@@ -178,7 +178,7 @@ | @@ -178,7 +178,7 @@ | ||
178 | ); | 178 | ); |
179 | } | 179 | } |
180 | 180 | ||
181 | - if (time() - intval($data_array["timestamp"]) > 30) { | 181 | + if (time() - intval($data_array["timestamp"]) > 300) { |
182 | return $data_array + array("valid" => FALSE); | 182 | return $data_array + array("valid" => FALSE); |
183 | } | 183 | } |
184 | 184 | ||
@@ -259,7 +259,7 @@ | @@ -259,7 +259,7 @@ | ||
259 | return FALSE; | 259 | return FALSE; |
260 | } | 260 | } |
261 | 261 | ||
262 | - if (empty($data_array['pwd']) || empty($data_array['login']) || empty($data_array['first_name']) || empty($data_array['last_name']) || empty($data_array['email'])) { | 262 | + if (empty($data_array['pwd']) || empty($data_array['login'])) { |
263 | return FALSE; | 263 | return FALSE; |
264 | } | 264 | } |
265 | 265 | ||
@@ -272,7 +272,10 @@ | @@ -272,7 +272,10 @@ | ||
272 | $stderr = fopen("php://stderr","w"); | 272 | $stderr = fopen("php://stderr","w"); |
273 | $userManager = new UserManagerClass($stderr); | 273 | $userManager = new UserManagerClass($stderr); |
274 | $pwd_hash = crypt($data_array['pwd'],chr(rand(97,122)).chr(rand(97,122))); | 274 | $pwd_hash = crypt($data_array['pwd'],chr(rand(97,122)).chr(rand(97,122))); |
275 | - return ($userManager->AddUser($data_array['login'], $pwd_hash, $data_array['first_name'], $data_array['last_name'], $data_array['email'], 1, '') == 1); | 275 | + $first_name = !array_key_exists('first_name', $data_array) ? "" : $data_array['first_name']; |
276 | + $last_name = !array_key_exists('last_name', $data_array) ? "" : $data_array['last_name']; | ||
277 | + $email = !array_key_exists('email', $data_array) ? "" : $data_array['email']; | ||
278 | + return ($userManager->AddUser($data_array['login'], $pwd_hash, $first_name, $last_name, $email, 1, '') == 1); | ||
276 | } | 279 | } |
277 | 280 | ||
278 | /* | 281 | /* |