Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7652637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:49:27+00:00 2026-05-31T11:49:27+00:00

Ladies and gentlemen, I am working hard on a new webapplication which is based

  • 0

Ladies and gentlemen,

I am working hard on a new webapplication which is based on the Zend Framework.
Almost the whole webapplication will be secured with a login(username and password).

My idea is to check if the visitor can be authenticated and if not check if the user is requesting a login route. If he is not trying to login he will be redirected to the login page.

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{  
    /**
     * Bootstrap::_initRouterRewrites()
     * 
     * @return void
     */
    protected function _initRouterRewrites()
    {
        $frontController  = Zend_Controller_Front::getInstance();
        $this->router = $frontController->getRouter();

        $this->router->addRoute(
            'default',
            new Zend_Controller_Router_Route('/',
                                            array('controller' => 'index',
                                                  'action' => 'index'))
                     )
                     ->addRoute(
            'login',
            new Zend_Controller_Router_Route('/inloggen.html',
                                            array('controller' => 'auth',
                                                  'action' => 'login'))
        ); 
    }

    /**
     * Bootstrap::_initZendSession()
     * 
     * @return void
     */
    protected function _initZendSession()
    {
        // Ensure that both the session and the db resources are bootstrapped
        $this->bootstrap(array('db', 'session'));

        // Actually start the session
        Zend_Session::start();
    }

    /**
     * Bootstrap::_initAuthentication()
     * 
     * @return void
     */
    protected function _initAuthentication()
    {
        // Instantiate auth object
        $auth = Zend_Auth::getInstance();

        // Check if visitor has an identity
        if (!$auth->hasIdentity())
        {

        }
    }
}

When I use the method $this->router->getCurrrentRoute() inthe _initAuthentication method I get the following error: “Current route is not defined”.

What can I do to check if the current route is login?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:49:28+00:00Added an answer on May 31, 2026 at 11:49 am

    At the time of bootstrapping routing has run yet. What you need here is a FrontController Plugin that hooks into the request lifecycle at the appropriate place . In your case that is probably going to be during routeShutdown after the routing has determined where to dispatch the request.

    From http://devzone.zend.com/1692/zend-framework-mvc-request-lifecycle/:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi Ladies and Gentlemen, We've quite big project with own build framework, based mostly
Ladies & Gentlemen, I´m new to Java, forgive me if it´s obvious, but I
Ladies and Gentlemen, For quite a long time now, I've been using the following
Good evening ladies and gentlemen! Searching for a cross-browser solution to embed commercial fonts
Good evening ladies and gentlemen, I have a problem with Java Swing that I
Ladies & Gentlemen, Short Version: Trying to dynamically create a Spine Model Class. Basically
Ladies and gents, I have a CRM page which references 3 js files, (1x
Gentlemen and esteemed ladies. I posted this question in the COM forum at Code
Ladies and gents, I found a very strange behavior which I cannot explain: Assume
ladies and gentlemen! Very often on my job I meet the following requirement from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.