controllers/AuthController.php
/**
     * Identifies inputs and accordingly routes request to various actions
     *
     * @param array $uriParams
     * @param array $formParams
     */
Identifies inputs and accordingly routes request to various actions
@param array $uriParams
@param array $formParams
Identifies inputs and accordingly routes request to various actions @param array $uriParams @param array $formParams
private function redirectAuthRequest (array $uriParams, array $formParams) {
        $formKey = '';
        $authAction = $uriParams[Constants::INPUT_PARAM_ACTION];
        if (empty($authAction) || $authAction === Constants::AUTH_LOGIN_URI_KEY) {
            if (!empty($formParams[self::LOGIN_ACTION_NAME])) {
                $formKey = $formParams[self::LOGIN_ACTION_NAME];
            }
            $isValidKey = ($formKey === self::LOGIN_ACTION_VALUE);
            if (!self::isLoggedIn() && $isValidKey && RequestManager::isAjaxRequest()) {
                $this->authenticate($formParams);
            } else {
                if (RequestManager::isAjaxRequest()) {
                    Response::sendResponse(Constants::FAILURE_RESPONSE, Messages::ERROR_USER_NOT_LOGGED_IN);
                } else {
                    $this->getView()->setViewName(self::AUTH_LOGIN_KEY)->display();
                }
            }
        } elseif ($authAction === Constants::AUTH_CHANGE_PASSWORD_URI_KEY) {
            $formKey = $formParams[self::CHPWD_ACTION_NAME];
            if ($formKey == self::CHPWD_ACTION_VALUE) {
                $this->changePassword($formParams);
            } else {
                RequestManager::redirect();
            }
        } elseif (self::isLoggedIn() && $authAction === Constants::AUTH_LOGOUT_URI_KEY) {
            $this->logout();
        } else {
            if (RequestManager::isAjaxRequest()) {
                Response::sendResponse(Constants::FAILURE_RESPONSE, Messages::ERROR_USER_NOT_LOGGED_IN);
            } else {
                RequestManager::redirect(Constants::AUTH_URI_KEY);
            }
        }
    }
private function redirectAuthRequest ( array $ uriParams , array $ formParams ) { $ formKey = '' ; $ authAction = $ uriParams [ Constants :: INPUT_PARAM_ACTION ] ; if ( empty ( $ authAction ) || $ authAction === Constants :: AUTH_LOGIN_URI_KEY ) { if ( ! empty ( $ formParams [ self :: LOGIN_ACTION_NAME ] ) ) { $ formKey = $ formParams [ self :: LOGIN_ACTION_NAME ] ; } $ isValidKey = ( $ formKey === self :: LOGIN_ACTION_VALUE ) ; if ( ! self :: isLoggedIn ( ) && $ isValidKey && RequestManager :: isAjaxRequest ( ) ) { $ this -> authenticate ( $ formParams ) ; } else { if ( RequestManager :: isAjaxRequest ( ) ) { Response :: sendResponse ( Constants :: FAILURE_RESPONSE , Messages :: ERROR_USER_NOT_LOGGED_IN ) ; } else { $ this -> getView ( ) -> setViewName ( self :: AUTH_LOGIN_KEY ) -> display ( ) ; } } } elseif ( $ authAction === Constants :: AUTH_CHANGE_PASSWORD_URI_KEY ) { $ formKey = $ formParams [ self :: CHPWD_ACTION_NAME ] ; if ( $ formKey == self :: CHPWD_ACTION_VALUE ) { $ this -> changePassword ( $ formParams ) ; } else { RequestManager :: redirect ( ) ; } } elseif ( self :: isLoggedIn ( ) && $ authAction === Constants :: AUTH_LOGOUT_URI_KEY ) { $ this -> logout ( ) ; } else { if ( RequestManager :: isAjaxRequest ( ) ) { Response :: sendResponse ( Constants :: FAILURE_RESPONSE , Messages :: ERROR_USER_NOT_LOGGED_IN ) ; } else { RequestManager :: redirect ( Constants :: AUTH_URI_KEY ) ; } } }
Identifies inputs and accordingly routes request to various actions
 @param array $uriParams
 @param array $formParams
Identifies inputs and accordingly routes request to various actions @param array $uriParams @param array $formParams