2013-09-20 21:36:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function reset_password(){
|
|
|
|
//filter all data
|
|
|
|
$email = filter_var($_GET["email"], FILTER_SANITIZE_EMAIL);
|
|
|
|
$user = filter_var($_GET["user"], FILTER_SANITIZE_STRING);
|
|
|
|
$key = filter_var($_GET["key"], FILTER_SANITIZE_STRING);
|
2014-09-03 05:06:43 +00:00
|
|
|
|
2013-09-20 21:36:19 +00:00
|
|
|
$password = filter_var($_POST['NewPass'], FILTER_SANITIZE_STRING);
|
|
|
|
$confirmpass = filter_var($_POST['ConfirmNewPass'], FILTER_SANITIZE_STRING);
|
|
|
|
|
|
|
|
$target_id = WebUsers::getId($user);
|
|
|
|
$webUser = new WebUsers($target_id);
|
|
|
|
if( (WebUsers::getIdFromEmail($email) == $target_id) && (hash('sha512',$webUser->getHashedPass()) == $key) ){
|
|
|
|
$params = Array( 'user' => $user, 'CurrentPass' => "dummy", 'NewPass' => $password, 'ConfirmNewPass' => $confirmpass, 'adminChangesOther' => true);
|
|
|
|
$result = $webUser->check_change_password($params);
|
|
|
|
if ($result == "success"){
|
|
|
|
$result = array();
|
|
|
|
$status = WebUsers::setPassword($user, $password);
|
|
|
|
if($status == 'ok'){
|
|
|
|
$result['SUCCESS_PASS'] = "OK";
|
|
|
|
}else if($status == 'shardoffline'){
|
|
|
|
$result['SUCCESS_PASS'] = "SHARDOFF";
|
|
|
|
}
|
|
|
|
$result['no_visible_elements'] = 'TRUE';
|
|
|
|
helpers :: loadtemplate( 'reset_success', $result);
|
2014-09-03 05:23:39 +00:00
|
|
|
throw new SystemExit();
|
2014-09-03 05:06:43 +00:00
|
|
|
}
|
2013-09-20 21:36:19 +00:00
|
|
|
$GETString = "";
|
|
|
|
foreach($_GET as $key => $value){
|
|
|
|
$GETString = $GETString . $key . '=' . $value . "&";
|
2014-09-03 05:06:43 +00:00
|
|
|
}
|
2013-09-20 21:36:19 +00:00
|
|
|
if($GETString != ""){
|
|
|
|
$GETString = '?'.$GETString;
|
|
|
|
}
|
|
|
|
$result['getstring'] = $GETString;
|
|
|
|
$result['prevNewPass'] = $password;
|
|
|
|
$result['prevConfirmNewPass'] = $confirmpass;
|
|
|
|
$result['no_visible_elements'] = 'TRUE';
|
|
|
|
helpers :: loadtemplate( 'reset_password', $result);
|
2014-09-03 05:23:39 +00:00
|
|
|
throw new SystemExit();
|
2014-09-03 05:06:43 +00:00
|
|
|
|
2013-09-20 21:36:19 +00:00
|
|
|
}
|
2014-09-03 05:06:43 +00:00
|
|
|
}
|