Skip to content

Commit c437aef

Browse files
committed
Redirect to the login page instead
1 parent 3bc0e10 commit c437aef

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/controllers/UsersController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ public function actionImpersonateWithToken(int $userId, int $prevUserId): ?Respo
379379
$this->setFailFlash(Craft::t('app', 'There was a problem impersonating this user.'));
380380
Craft::error(sprintf('%s tried to impersonate userId: %s but something went wrong.',
381381
$userSession->getIdentity()?->username ?? 'Unknown user', $userId), __METHOD__);
382-
return $this->redirectToPostedUrl();
382+
return $this->redirect($this->request->getIsCpRequest()
383+
? Request::CP_PATH_LOGIN
384+
: Craft::$app->getConfig()->getGeneral()->getLoginPath() ?? '');
383385
}
384386

385387
return $this->_handleSuccessfulLogin($user);

0 commit comments

Comments
 (0)