Skip to content

Commit 14f56e5

Browse files
David Coutadeurdavidcoutadeur
authored andcommitted
remove pwd_show_policy_onerror unused variable (#78)
1 parent c1b9eef commit 14f56e5

File tree

2 files changed

+0
-72
lines changed

2 files changed

+0
-72
lines changed

src/Ltb/Ppolicy.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,6 @@ static function smarty_assign_ppolicy($smarty, $pwd_show_policy_pos, $pwd_show_p
254254
if (isset($pwd_show_policy_pos)) {
255255
$smarty->assign('pwd_show_policy_pos', $pwd_show_policy_pos);
256256
$smarty->assign('pwd_show_policy', $pwd_show_policy);
257-
$smarty->assign('pwd_show_policy_onerror', true);
258-
if ( $pwd_show_policy === "onerror" ) {
259-
if ( !preg_match( "/tooshort|toobig|minlower|minupper|mindigit|minspecial|forbiddenchars|sameasold|notcomplex|sameaslogin|pwned|specialatends/" , $result) ) {
260-
$smarty->assign('pwd_show_policy_onerror', false);
261-
} else {
262-
$smarty->assign('pwd_show_policy_onerror', true);
263-
}
264-
}
265257
self::smarty_assign_variable($smarty, $pwd_policy_config);
266258

267259
// send policy to a JSON object usable in javascript

tests/Ltb/PpolicyTest.php

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,6 @@ public function test_smarty_assign_ppolicy()
340340
$smarty->shouldreceive('assign')
341341
->once()
342342
->with("pwd_show_policy", $pwd_show_policy );
343-
$smarty->shouldreceive('assign')
344-
->once()
345-
->with("pwd_show_policy_onerror", true );
346343

347344
foreach ($pwd_policy_config as $param => $value) {
348345
if( isset($value) )
@@ -368,65 +365,4 @@ public function test_smarty_assign_ppolicy()
368365

369366
}
370367

371-
public function test_smarty_assign_ppolicy_show_policy_onerror()
372-
{
373-
374-
$pwd_policy_config = array();
375-
376-
$smarty = Mockery::mock('Smarty');
377-
$pwd_show_policy_pos = "above";
378-
$pwd_show_policy = "onerror";
379-
$result = "forbiddenchars";
380-
381-
$smarty->shouldreceive('assign')
382-
->once()
383-
->with("pwd_show_policy_pos", $pwd_show_policy_pos );
384-
$smarty->shouldreceive('assign')
385-
->once()
386-
->with("pwd_show_policy", $pwd_show_policy );
387-
$smarty->shouldreceive('assign')
388-
->twice()
389-
->with("pwd_show_policy_onerror", true );
390-
391-
$smarty->shouldreceive('assign')
392-
->once()
393-
->with("json_policy", base64_encode(json_encode( $pwd_policy_config )) );
394-
395-
\Ltb\Ppolicy::smarty_assign_ppolicy($smarty, $pwd_show_policy_pos, $pwd_show_policy, $result, $pwd_policy_config);
396-
397-
$this->assertNotNull($smarty, "smarty variable is null while testing smarty_assign_ppolicy" );
398-
399-
}
400-
401-
public function test_smarty_assign_ppolicy_show_policy_onerror_dummy()
402-
{
403-
404-
$pwd_policy_config = array();
405-
406-
$smarty = Mockery::mock('Smarty');
407-
$pwd_show_policy_pos = "above";
408-
$pwd_show_policy = "onerror";
409-
$result = "dummy";
410-
411-
$smarty->shouldreceive('assign')
412-
->once()
413-
->with("pwd_show_policy_pos", $pwd_show_policy_pos );
414-
$smarty->shouldreceive('assign')
415-
->once()
416-
->with("pwd_show_policy", $pwd_show_policy );
417-
$smarty->shouldreceive('assign')
418-
->with("pwd_show_policy_onerror", true );
419-
$smarty->shouldreceive('assign')
420-
->with("pwd_show_policy_onerror", false );
421-
422-
$smarty->shouldreceive('assign')
423-
->once()
424-
->with("json_policy", base64_encode(json_encode( $pwd_policy_config )) );
425-
426-
\Ltb\Ppolicy::smarty_assign_ppolicy($smarty, $pwd_show_policy_pos, $pwd_show_policy, $result, $pwd_policy_config);
427-
428-
$this->assertNotNull($smarty, "smarty variable is null while testing smarty_assign_ppolicy" );
429-
430-
}
431-
432368
}

0 commit comments

Comments
 (0)