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
3f54b93b30
5 changed files with 22 additions and 21 deletions
|
@ -129,8 +129,8 @@ go_home = "Go Home"
|
|||
userlist_info = "welcome to the userlist"
|
||||
|
||||
[login]
|
||||
login_info = "Please login with your Username and Password."
|
||||
login_error_message = "The username/password were not correct!"
|
||||
login_info = "Please login with your Email/Username and Password."
|
||||
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_here = "here"
|
||||
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!"
|
||||
|
||||
[login]
|
||||
login_info = "S'il vous plait vous connecter avec votre nom d'utilisateur et mot de passe."
|
||||
login_error_message = "Le remplie nom d'utilisateur / mot de passe ne sont pas correctes!"
|
||||
login_info = "S'il vous plait vous connecter avec votre Email/nom d'utilisateur et mot de passe."
|
||||
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_here = "ici"
|
||||
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.
|
||||
* @param $username the inserted username
|
||||
* check if the login username/email and password match the db.
|
||||
* @param $value the inserted username or email
|
||||
* @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.
|
||||
*/
|
||||
public static function checkLoginMatch($username,$password){
|
||||
public static function checkLoginMatch($value,$password){
|
||||
|
||||
$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();
|
||||
$salt = substr($row['Password'],0,2);
|
||||
$hashed_input_pass = crypt($password, $salt);
|
||||
|
@ -89,9 +89,9 @@ class WebUsers extends Users{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* returns te id for a given username
|
||||
* returns the id for a given username
|
||||
* @param $username 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
|
||||
* @return the user's id linked to the emailaddress
|
||||
*/
|
||||
|
@ -118,7 +118,7 @@ class WebUsers extends Users{
|
|||
return "FALSE";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get uId attribute of the object.
|
||||
|
@ -355,4 +355,4 @@ class WebUsers extends Users{
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,16 @@ function login(){
|
|||
global $INGAME_WEBPATH;
|
||||
global $WEBPATH;
|
||||
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);
|
||||
//check if the filtered sent POST data returns a match with the DB
|
||||
$result = WebUsers::checkLoginMatch($username, $password);
|
||||
|
||||
//check if the filtered sent POST data returns a match with the DB
|
||||
$result = WebUsers::checkLoginMatch($login_value, $password);
|
||||
|
||||
if( $result != "fail"){
|
||||
//handle successful login
|
||||
$_SESSION['user'] = $username;
|
||||
$_SESSION['id'] = WebUsers::getId($username);
|
||||
$_SESSION['user'] = $result['Login'];
|
||||
$_SESSION['id'] = $result['UId'];
|
||||
$_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
|
||||
$user = new WebUsers($_SESSION['id']);
|
||||
$_SESSION['Language'] = $user->getLanguage();
|
||||
|
@ -54,4 +55,4 @@ function login(){
|
|||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
</div>
|
||||
<form method="post" action="index.php{if isset($getstring)}{$getstring}{/if}" class="form-horizontal">
|
||||
<fieldset>
|
||||
<div data-rel="tooltip" class="input-prepend" data-original-title="Username">
|
||||
<span class="add-on"><i class="icon-user"></i></span><input type="text" value="" id="Username" name="Username" class="input-large span10" placeholder="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="LoginValue" name="LoginValue" class="input-large span10" placeholder="Username or Email">
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue