mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-30 23:45:59 +00:00
Merged in shubham_meena/ryzomcore/Issue#123 (pull request #59)
Changed log-in from username to both username and email
This commit is contained in:
commit
61bda09239
5 changed files with 22 additions and 21 deletions
|
@ -129,8 +129,8 @@ go_home = "Go Home"
|
||||||
userlist_info = "welcome to the userlist"
|
userlist_info = "welcome to the userlist"
|
||||||
|
|
||||||
[login]
|
[login]
|
||||||
login_info = "Please login with your Username and Password."
|
login_info = "Please login with your Email/Username and Password."
|
||||||
login_error_message = "The username/password were not correct!"
|
login_error_message = "The Email/username/password were not correct!"
|
||||||
login_register_message ="<strong>Register</strong> If you don't have an account yet, create one"
|
login_register_message ="<strong>Register</strong> If you don't have an account yet, create one"
|
||||||
login_here = "here"
|
login_here = "here"
|
||||||
login_forgot_password_message = "In case you forgot your password, click"
|
login_forgot_password_message = "In case you forgot your password, click"
|
||||||
|
|
|
@ -119,8 +119,8 @@ go_home = "Allez au main page"
|
||||||
userlist_info = "bienvenue sur le userlist page!"
|
userlist_info = "bienvenue sur le userlist page!"
|
||||||
|
|
||||||
[login]
|
[login]
|
||||||
login_info = "S'il vous plait vous connecter avec votre nom d'utilisateur et mot de passe."
|
login_info = "S'il vous plait vous connecter avec votre Email/nom d'utilisateur et mot de passe."
|
||||||
login_error_message = "Le remplie nom d'utilisateur / mot de passe ne sont pas correctes!"
|
login_error_message = "Le remplie Email/nom d'utilisateur / mot de passe ne sont pas correctes!"
|
||||||
login_register_message ="<strong> Inscrivez-vous </strong> Si vous n'avez pas encore de compte, creez-en un"
|
login_register_message ="<strong> Inscrivez-vous </strong> Si vous n'avez pas encore de compte, creez-en un"
|
||||||
login_here = "ici"
|
login_here = "ici"
|
||||||
login_forgot_password_message = "Dans le cas ou vous avez oublie votre mot de passe, cliquez"
|
login_forgot_password_message = "Dans le cas ou vous avez oublie votre mot de passe, cliquez"
|
||||||
|
|
|
@ -70,15 +70,15 @@ class WebUsers extends Users{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if the login username and password match the db.
|
* check if the login username/email and password match the db.
|
||||||
* @param $username the inserted username
|
* @param $value the inserted username or email
|
||||||
* @param $password the inserted password (unhashed)
|
* @param $password the inserted password (unhashed)
|
||||||
* @return the logged in user's db row as array if login was a success, else "fail" will be returned.
|
* @return the logged in user's db row as array if login was a success, else "fail" will be returned.
|
||||||
*/
|
*/
|
||||||
public static function checkLoginMatch($username,$password){
|
public static function checkLoginMatch($value,$password){
|
||||||
|
|
||||||
$dbw = new DBLayer("web");
|
$dbw = new DBLayer("web");
|
||||||
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:user", array('user' => $username));
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:value OR Email:value", array('value' => $value));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$salt = substr($row['Password'],0,2);
|
$salt = substr($row['Password'],0,2);
|
||||||
$hashed_input_pass = crypt($password, $salt);
|
$hashed_input_pass = crypt($password, $salt);
|
||||||
|
@ -91,7 +91,7 @@ class WebUsers extends Users{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns te id for a given username
|
* returns the id for a given username
|
||||||
* @param $username the username
|
* @param $username the username
|
||||||
* @return the user's id linked to the username
|
* @return the user's id linked to the username
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +104,7 @@ class WebUsers extends Users{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns te id for a given emailaddress
|
* returns the id for a given emailaddress
|
||||||
* @param $email the emailaddress
|
* @param $email the emailaddress
|
||||||
* @return the user's id linked to the emailaddress
|
* @return the user's id linked to the emailaddress
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,15 +9,16 @@ function login(){
|
||||||
global $INGAME_WEBPATH;
|
global $INGAME_WEBPATH;
|
||||||
global $WEBPATH;
|
global $WEBPATH;
|
||||||
try{
|
try{
|
||||||
$username = filter_var($_POST['Username'],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 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($username, $password);
|
$result = WebUsers::checkLoginMatch($login_value, $password);
|
||||||
|
|
||||||
if( $result != "fail"){
|
if( $result != "fail"){
|
||||||
//handle successful login
|
//handle successful login
|
||||||
$_SESSION['user'] = $username;
|
$_SESSION['user'] = $result['Login'];
|
||||||
$_SESSION['id'] = WebUsers::getId($username);
|
$_SESSION['id'] = $result['UId'];
|
||||||
$_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();
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="index.php{if isset($getstring)}{$getstring}{/if}" class="form-horizontal">
|
<form method="post" action="index.php{if isset($getstring)}{$getstring}{/if}" class="form-horizontal">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div data-rel="tooltip" class="input-prepend" data-original-title="Username">
|
<div data-rel="tooltip" class="input-prepend" data-original-title="Username/Email">
|
||||||
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" placeholder="Username">
|
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="LoginValue" name="LoginValue" class="input-large span10" placeholder="Username or Email">
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue