Skip to content

Commit 324ec73

Browse files
committed
Refactor process_login_request 1: Extract method process_login_request().
1 parent 7ce32a2 commit 324ec73

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

interface/web/login/index.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@
5656
$maintenance_mode_error = $app->lng('error_maintenance_mode');
5757
}
5858

59-
//* Login Form was sent
60-
if (count($_POST) > 0) {
61-
59+
/**
60+
* @param app $app
61+
* @param $error
62+
* @param $conf
63+
* @param $module
64+
* @return void
65+
*/
66+
function process_login_request(app $app, &$error, $conf, $module)
67+
{
6268
//** Check variables
6369
if (!preg_match("/^[\w\.\-\_\@]{1,128}$/", $app->functions->idn_encode($_POST['username']))) $error = $app->lng('user_regex_error');
6470
if (!preg_match("/^.{1,256}$/i", $_POST['password'])) $error = $app->lng('pw_error_length');
@@ -307,6 +313,11 @@
307313
}
308314
}
309315

316+
//* Login Form was sent
317+
if (count($_POST) > 0) {
318+
process_login_request($app, $error, $conf, $module);
319+
}
320+
310321
// Maintenance mode - show message when people try to log in and also when people are forcibly logged off
311322
if ($maintenance_mode_error != '') $error = '<strong>'.$maintenance_mode_error.'</strong><br><br>'.$error;
312323
if ($error != '') {

0 commit comments

Comments
 (0)