Login: Display error message on invalid login credentials.
This commit is contained in:
@@ -25,24 +25,35 @@
|
|||||||
*/
|
*/
|
||||||
include "root.php";
|
include "root.php";
|
||||||
|
|
||||||
//clear the session variables
|
//start session
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
//retain message
|
||||||
|
$message_mood = $_SESSION["message_mood"];
|
||||||
|
$message = $_SESSION["message"];
|
||||||
|
|
||||||
|
//destroy session
|
||||||
session_unset();
|
session_unset();
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|
||||||
//if config.php file does not exist then redirect to the install page
|
//if config.php file does not exist then redirect to the install page
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
}
|
||||||
|
else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
||||||
//original directory
|
//original directory
|
||||||
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
|
}
|
||||||
|
else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
|
||||||
//move config.php from the includes to resources directory.
|
//move config.php from the includes to resources directory.
|
||||||
rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
|
rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
|
||||||
} elseif (file_exists("/etc/fusionpbx/config.php")){
|
}
|
||||||
|
else if (file_exists("/etc/fusionpbx/config.php")){
|
||||||
//linux
|
//linux
|
||||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){
|
}
|
||||||
|
else if (file_exists("/usr/local/etc/fusionpbx/config.php")){
|
||||||
//bsd
|
//bsd
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
header("Location: ".PROJECT_PATH."/resources/install.php");
|
header("Location: ".PROJECT_PATH."/resources/install.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -50,6 +61,10 @@ include "root.php";
|
|||||||
//adds multiple includes
|
//adds multiple includes
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
|
|
||||||
|
//restore message
|
||||||
|
$_SESSION["message_mood"] = $message_mood;
|
||||||
|
$_SESSION["message"] = $message;
|
||||||
|
|
||||||
//use custom login, if present, otherwise use default login
|
//use custom login, if present, otherwise use default login
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
|
||||||
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
|
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ require_once "resources/require.php";
|
|||||||
//if the username is not provided then send to login.php
|
//if the username is not provided then send to login.php
|
||||||
if (strlen(check_str($_REQUEST["username"])) == 0 && strlen(check_str($_REQUEST["key"])) == 0) {
|
if (strlen(check_str($_REQUEST["username"])) == 0 && strlen(check_str($_REQUEST["key"])) == 0) {
|
||||||
$target_path = ($_REQUEST["path"] != '') ? $_REQUEST["path"] : $_SERVER["REQUEST_URI"];
|
$target_path = ($_REQUEST["path"] != '') ? $_REQUEST["path"] : $_SERVER["REQUEST_URI"];
|
||||||
|
$_SESSION["message_mood"] = "negative";
|
||||||
$_SESSION["message"] = "Invalid Username and/or Password";
|
$_SESSION["message"] = "Invalid Username and/or Password";
|
||||||
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($target_path));
|
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($target_path));
|
||||||
exit;
|
exit;
|
||||||
@@ -280,6 +281,7 @@ require_once "resources/require.php";
|
|||||||
closelog();
|
closelog();
|
||||||
//redirect the user to the login page
|
//redirect the user to the login page
|
||||||
$target_path = ($_REQUEST["path"] != '') ? $_REQUEST["path"] : $_SERVER["PHP_SELF"];
|
$target_path = ($_REQUEST["path"] != '') ? $_REQUEST["path"] : $_SERVER["PHP_SELF"];
|
||||||
|
$_SESSION["message_mood"] = "negative";
|
||||||
$_SESSION["message"] = "Invalid Username and/or Password";
|
$_SESSION["message"] = "Invalid Username and/or Password";
|
||||||
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($target_path));
|
header("Location: ".PROJECT_PATH."/login.php?path=".urlencode($target_path));
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
Reference in New Issue
Block a user