|
|
@@ -20,11 +20,16 @@ if ((!empty($_POST['user'])) && (empty($_POST['code']))) {
|
|
|
$data = json_decode(implode('', $output), true);
|
|
|
if($email == $data[$user]['CONTACT']){
|
|
|
//genrate new rkey
|
|
|
- exec ("/usr/bin/sudo /usr/local/hestia/bin/v-change-user-rkey ".$v_user."", $output, $return_var);
|
|
|
+ $rkey = substr( password_hash( 'hestiacp', PASSWORD_DEFAULT ), 5, 12 );
|
|
|
+ $hash = password_hash($rkey, PASSWORD_DEFAULT);
|
|
|
+ $v_rkey = tempnam("/tmp","vst");
|
|
|
+ $fp = fopen($v_rkey, "w");
|
|
|
+ fwrite($fp, $hash."\n");
|
|
|
+ fclose($fp);
|
|
|
+ exec ("/usr/bin/sudo /usr/local/hestia/bin/v-change-user-rkey ".$v_user." ".$v_rkey."", $output, $return_var);
|
|
|
unset($output);
|
|
|
exec ($cmd." ".$v_user." json", $output, $return_var);
|
|
|
$data = json_decode(implode('', $output), true);
|
|
|
- $rkey = $data[$user]['RKEY'];
|
|
|
$name = $data[$user]['NAME'];
|
|
|
$contact = $data[$user]['CONTACT'];
|
|
|
$to = $data[$user]['CONTACT'];
|
|
|
@@ -58,7 +63,7 @@ if ((!empty($_POST['user'])) && (!empty($_POST['code'])) && (!empty($_POST['pass
|
|
|
if ( $return_var == 0 ) {
|
|
|
$data = json_decode(implode('', $output), true);
|
|
|
$rkey = $data[$user]['RKEY'];
|
|
|
- if (hash_equals($rkey, $_POST['code'])) {
|
|
|
+ if (password_verify($_POST['code'], $rkey)) {
|
|
|
unset($output);
|
|
|
exec("/usr/bin/sudo /usr/local/hestia/bin/v-get-user-value ".$v_user." RKEYEXP", $output,$return_var);
|
|
|
if($output[0] > time() - 900){
|