This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Routes/Users/FinishPasswordReset.php
2014-11-22 12:44:45 +01:00

34 lines
713 B
PHP

<?php
namespace Szurubooru\Routes\Users;
use Szurubooru\Services\TokenService;
use Szurubooru\Services\UserService;
class FinishPasswordReset extends AbstractUserRoute
{
private $userService;
private $tokenService;
public function __construct(
UserService $userService,
TokenService $tokenService)
{
$this->userService = $userService;
$this->tokenService = $tokenService;
}
public function getMethods()
{
return ['POST', 'PUT'];
}
public function getUrl()
{
return '/api/finish-password-reset/:tokenName';
}
public function work($args)
{
$token = $this->tokenService->getByName($args['tokenName']);
return ['newPassword' => $this->userService->finishPasswordReset($token)];
}
}