Redirecting to custom sign-in page when accessing restricted pages
Hi all, I've extended the sign-in / sign-up on our main website to communicate with Vanilla so users only need to go through the main website.
However, when some restricted pages in Vanilla are accessed the call to $this->Permission('Garden.SignIn.Allow');
redirects the user to the /entry/signin
page. This page isn't used by our app any more, so i'm wondering how to override the Gdn_Controller::Permission
method so that it redirects to our custom sign-in page, not the Vanilla one.
Only option I can think of is by using htaccess to redirect. But is there a another (better) way?
Best Answer
-
Bleistivt Moderator
In 2.2 you will be able to do this:
public function EntryController_OverrideSignIn_Handler($Sender, &$Args) { $Args[Target] = 'Your URL'; }
until that, I'd just do it like this:
public function Gdn_Dispatcher_AfterAnalyzeRequest_Handler($Sender) { if ($Sender->ControllerMethod == 'signin') { Redirect('Your URL'); } }
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
2
Answers
You can override that by defining a route called
DefaultPermission
under Dashboard/Routes.My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Hi @Bleistivt - unfortunately that doesn't seem to work. The route is already added, and even if I edit it with my custom URL, when I access any restricted pages the app still redirects to
entry/signin
.By the way my version is 2.1.9
In 2.2 you will be able to do this:
until that, I'd just do it like this:
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Perfect