2016-10-27 11:22:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include __DIR__.'/account.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the user password.
|
|
|
|
**/
|
2018-05-23 10:14:20 +00:00
|
|
|
class SetPassword extends Vn\Web\JsonRequest {
|
2016-10-27 11:22:04 +00:00
|
|
|
const PARAMS = [
|
|
|
|
'setUser'
|
|
|
|
,'setPassword'
|
|
|
|
];
|
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
function run($db) {
|
2016-10-27 11:22:04 +00:00
|
|
|
$setUser = $_REQUEST['setUser'];
|
|
|
|
$setPassword = $_REQUEST['setPassword'];
|
2020-10-23 10:10:41 +00:00
|
|
|
|
|
|
|
$userId = $db->getValue(
|
|
|
|
'SELECT id FROM account.user WHERE `name` = #',
|
|
|
|
[$setUser]
|
|
|
|
);
|
|
|
|
$db->query('CALL account.user_setPassword(#, #)',
|
|
|
|
[$userId, $setPassword]);
|
2018-05-23 10:14:20 +00:00
|
|
|
Account::sync($db, $setUser, $setPassword);
|
2016-10-27 11:22:04 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|