/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $token = $this->consumerService->login($record->username, $record->password); if (!empty($token)) { return ['token' => $token]; } else { throw new StatusCode\BadRequestException('Invalid name or password'); } }
/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $provider = $this->getUriFragment('provider'); $code = $record->code; $clientId = $record->clientId; $redirectUri = $record->redirectUri; $token = $this->consumerService->provider($provider, $code, $clientId, $redirectUri); if (!empty($token)) { return ['token' => $token]; } else { throw new StatusCode\UnauthorizedException('Invalid data', 'Basic'); } }
/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $this->consumerService->register($record->name, $record->email, $record->password, $record->captcha); return array('success' => true, 'message' => 'Registration successful'); }
/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $this->consumerService->activate($record->token); return array('success' => true, 'message' => 'Activation successful'); }