|
|
@ -313,6 +313,8 @@ class Users{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function check_change_password($values){
|
|
|
|
public function check_change_password($values){
|
|
|
|
|
|
|
|
//if admin isn't changing others
|
|
|
|
|
|
|
|
if(!$values['adminChangesOther']){
|
|
|
|
if ( isset( $values["user"] ) and isset( $values["CurrentPass"] ) and isset( $values["ConfirmNewPass"] ) and isset( $values["NewPass"] ) ){
|
|
|
|
if ( isset( $values["user"] ) and isset( $values["CurrentPass"] ) and isset( $values["ConfirmNewPass"] ) and isset( $values["NewPass"] ) ){
|
|
|
|
$match = $this->checkLoginMatch($values["user"],$values["CurrentPass"]);
|
|
|
|
$match = $this->checkLoginMatch($values["user"],$values["CurrentPass"]);
|
|
|
|
$newpass = $this->checkPassword($values["NewPass"]);
|
|
|
|
$newpass = $this->checkPassword($values["NewPass"]);
|
|
|
@ -322,19 +324,33 @@ class Users{
|
|
|
|
$newpass = "";
|
|
|
|
$newpass = "";
|
|
|
|
$confpass = "";
|
|
|
|
$confpass = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( ( $match != "fail" ) and ( $newpass == "success" ) and ( $confpass == "success" ) ){
|
|
|
|
}else{
|
|
|
|
|
|
|
|
//if admin is indeed changing someone!
|
|
|
|
|
|
|
|
if ( isset( $values["user"] ) and isset( $values["ConfirmNewPass"] ) and isset( $values["NewPass"] ) ){
|
|
|
|
|
|
|
|
$newpass = $this->checkPassword($values["NewPass"]);
|
|
|
|
|
|
|
|
$confpass = $this->confirmPassword($newpass,$values["NewPass"],$values["ConfirmNewPass"]);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$newpass = "";
|
|
|
|
|
|
|
|
$confpass = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !$values['adminChangesOther'] and ( $match != "fail" ) and ( $newpass == "success" ) and ( $confpass == "success" ) ){
|
|
|
|
|
|
|
|
return "success";
|
|
|
|
|
|
|
|
}else if($values['adminChangesOther'] and ( $newpass == "success" ) and ( $confpass == "success" ) ){
|
|
|
|
return "success";
|
|
|
|
return "success";
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$pageElements = array(
|
|
|
|
$pageElements = array(
|
|
|
|
'match_error_message' => $match,
|
|
|
|
|
|
|
|
'newpass_error_message' => $newpass,
|
|
|
|
'newpass_error_message' => $newpass,
|
|
|
|
'confirmnewpass_error_message' => $confpass
|
|
|
|
'confirmnewpass_error_message' => $confpass
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
if(!$values['adminChangesOther']){
|
|
|
|
|
|
|
|
$pageElements['match_error_message'] = $match;
|
|
|
|
if ( $match != "fail" ){
|
|
|
|
if ( $match != "fail" ){
|
|
|
|
$pageElements['MATCH_ERROR'] = 'FALSE';
|
|
|
|
$pageElements['MATCH_ERROR'] = 'FALSE';
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$pageElements['MATCH_ERROR'] = 'TRUE';
|
|
|
|
$pageElements['MATCH_ERROR'] = 'TRUE';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( $newpass != "success" ){
|
|
|
|
if ( $newpass != "success" ){
|
|
|
|
$pageElements['NEWPASSWORD_ERROR'] = 'TRUE';
|
|
|
|
$pageElements['NEWPASSWORD_ERROR'] = 'TRUE';
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
@ -348,6 +364,29 @@ class Users{
|
|
|
|
return $pageElements;
|
|
|
|
return $pageElements;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function setPassword($user, $pass){
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//make connection with and put into shard db
|
|
|
|
|
|
|
|
global $cfg;
|
|
|
|
|
|
|
|
$dbs = new DBLayer($cfg['db']['shard']);
|
|
|
|
|
|
|
|
$dbs->execute("UPDATE user SET Password = :pass WHERE Login = :user ",$values);
|
|
|
|
|
|
|
|
return "ok";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (PDOException $e) {
|
|
|
|
|
|
|
|
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
|
|
|
|
|
|
|
|
/*try {
|
|
|
|
|
|
|
|
$dbl = new DBLayer($cfg['db']['lib']);
|
|
|
|
|
|
|
|
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "createUser",
|
|
|
|
|
|
|
|
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"]))));
|
|
|
|
|
|
|
|
return "shardoffline";
|
|
|
|
|
|
|
|
}catch (PDOException $e) {
|
|
|
|
|
|
|
|
print_r($e);
|
|
|
|
|
|
|
|
return "liboffline";
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|