login.php edited online with Bitbucket: to provide access through both username and email
This commit is contained in:
parent
be4633c1b8
commit
7d92faa5be
1 changed files with 4 additions and 22 deletions
|
@ -12,31 +12,13 @@ function login(){
|
||||||
$login_value = filter_var($_POST['LoginValue'],FILTER_SANITIZE_STRING);
|
$login_value = filter_var($_POST['LoginValue'],FILTER_SANITIZE_STRING);
|
||||||
$password = filter_var($_POST['Password'],FILTER_SANITIZE_STRING);
|
$password = filter_var($_POST['Password'],FILTER_SANITIZE_STRING);
|
||||||
|
|
||||||
//check login type if email or username
|
|
||||||
$login_type = WebUsers::checkLoginType($login_value);
|
|
||||||
|
|
||||||
//check if the filtered sent POST data returns a match with the DB
|
//check if the filtered sent POST data returns a match with the DB
|
||||||
|
$result = WebUsers::checkLoginMatch($login_value, $password);
|
||||||
if($login_type == 'Login')
|
|
||||||
{
|
|
||||||
$result = WebUsers::checkLoginMatch($login_value, $password);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
$result = WebUsers::checkLoginMatchUsingEmail($login_value, $password);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $result != "fail"){
|
if( $result != "fail"){
|
||||||
//handle successful login
|
//handle successful login
|
||||||
|
$_SESSION['user'] = $result['Login'];
|
||||||
if($login_type == 'Login')
|
$_SESSION['id'] = $result['UId'];
|
||||||
{
|
|
||||||
$_SESSION['user'] = $login_value;
|
|
||||||
$_SESSION['id'] = WebUsers::getId($login_value);
|
|
||||||
}else{
|
|
||||||
$_SESSION['user'] = WebUsers::getUsernameFromEmail($login_value);
|
|
||||||
$_SESSION['id'] = WebUsers::getIdFromEmail($login_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
|
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
|
||||||
$user = new WebUsers($_SESSION['id']);
|
$user = new WebUsers($_SESSION['id']);
|
||||||
$_SESSION['Language'] = $user->getLanguage();
|
$_SESSION['Language'] = $user->getLanguage();
|
||||||
|
|
Loading…
Reference in a new issue