Update display name logic and handle invalid arguments.
This commit is contained in:
parent
1c4621c55b
commit
426df31421
1 changed files with 7 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
||||||
namespace Socialbox\Classes\StandardMethods;
|
namespace Socialbox\Classes\StandardMethods;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use ncc\ThirdParty\Symfony\Process\Exception\InvalidArgumentException;
|
||||||
use Socialbox\Abstracts\Method;
|
use Socialbox\Abstracts\Method;
|
||||||
use Socialbox\Enums\Flags\SessionFlags;
|
use Socialbox\Enums\Flags\SessionFlags;
|
||||||
use Socialbox\Enums\StandardError;
|
use Socialbox\Enums\StandardError;
|
||||||
|
@ -27,14 +28,15 @@
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Set the password
|
// Update the display name
|
||||||
RegisteredPeerManager::updateDisplayName($request->getPeer(), $rpcRequest->getParameter('name'));
|
RegisteredPeerManager::updateDisplayName($request->getPeer(), $rpcRequest->getParameter('name'));
|
||||||
|
|
||||||
// Remove the SET_PASSWORD flag
|
|
||||||
SessionManager::removeFlags($request->getSessionUuid(), [SessionFlags::SET_DISPLAY_NAME]);
|
|
||||||
|
|
||||||
// Check & update the session flow
|
// Check & update the session flow
|
||||||
SessionManager::updateFlow($request->getSession());
|
SessionManager::updateFlow($request->getSession(), [SessionFlags::SET_DISPLAY_NAME]);
|
||||||
|
}
|
||||||
|
catch(InvalidArgumentException)
|
||||||
|
{
|
||||||
|
return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Invalid display name');
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue