hedera-web/rest/core/change-password.php

22 lines
437 B
PHP
Raw Normal View History

2016-10-27 11:22:04 +00:00
<?php
include __DIR__.'/account.php';
/**
* Updates the user password.
**/
2018-05-23 10:14:20 +00:00
class ChangePassword extends Vn\Web\JsonRequest {
2016-10-27 11:22:04 +00:00
const PARAMS = ['newPassword'];
2018-05-23 10:14:20 +00:00
function run($db) {
2016-10-27 11:22:04 +00:00
$newPassword = $_REQUEST['newPassword'];
$oldPassword = $_REQUEST['oldPassword'];
2018-05-23 10:14:20 +00:00
$db->query('CALL account.myUserChangePassword(#, #)',
2016-10-27 11:22:04 +00:00
[$oldPassword, $newPassword]);
2018-05-23 10:14:20 +00:00
Account::sync($db, $_SESSION['user'], $newPassword);
2016-10-27 11:22:04 +00:00
return TRUE;
}
}