* @param string $toUrl The destination URL (Default is empty, which is the default page of the Friendica node)
* @param bool $ssl if true, base URL will try to get called with https:// (works just for relative paths)
*
+ * @throws HTTPException\FoundException
+ * @throws HTTPException\MovedPermanentlyException
+ * @throws HTTPException\TemporaryRedirectException
+ *
* @throws HTTPException\InternalServerErrorException In Case the given URL is not relative to the Friendica node
*/
public function redirect(string $toUrl = '', bool $ssl = false)
*
* @param string $url The new Location to redirect
* @param int $code The redirection code, which is used (Default is 302)
+ *
+ * @throws FoundException
+ * @throws MovedPermanentlyException
+ * @throws TemporaryRedirectException
+ *
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function externalRedirect($url, $code = 302)
{
use Friendica\Model\User;
use Friendica\Model\User\Cookie;
use Friendica\Module\Response;
+use Friendica\Network\HTTPException\FoundException;
+use Friendica\Network\HTTPException\MovedPermanentlyException;
+use Friendica\Network\HTTPException\TemporaryRedirectException;
use Friendica\Security\Authentication;
use Friendica\Util\Profiler;
use Friendica\Security\TwoFactor;
try {
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
- } catch (\Exception $exception) {
+ } catch (FoundException | TemporaryRedirectException | MovedPermanentlyException $e) {
+ // exception wanted!
+ throw $e;
+ } catch (\Exception $e) {
$this->logger->warning('Unexpected error during authentication.', ['user' => $this->app->getLoggedInUserId(), 'exception' => $exception]);
}
}
* @param bool $interactive
* @param bool $login_refresh
*
+ * @throws HTTPException\FoundException
+ * @throws HTTPException\MovedPermanentlyException
+ * @throws HTTPException\TemporaryRedirectException
+ * @throws HTTPException\ForbiddenException
+
* @throws HTTPException\InternalServerErrorException In case of Friendica specific exceptions
- * @throws Exception In case of general Exceptions (like SQL Grammar exceptions)
+ *
*/
public function setForUser(App $a, array $user_record, bool $login_initial = false, bool $interactive = false, bool $login_refresh = false)
{