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

29 lines
520 B
PHP

<?php
include __DIR__.'/account.php';
/**
* Sets the user password.
*/
class SetPassword extends Vn\Web\JsonRequest {
const PARAMS = [
'setUser'
,'setPassword'
];
function run($db) {
$setUser = $_REQUEST['setUser'];
$setPassword = $_REQUEST['setPassword'];
$userId = $db->getValue(
'SELECT id FROM account.user WHERE `name` = #',
[$setUser]
);
$db->query('CALL account.user_setPassword(#, #)',
[$userId, $setPassword]);
Account::sync($db, $setUser, $setPassword);
return TRUE;
}
}