controllers/AuthController.php
/**
     * Authenticate user login request
     *
     * @param array $formParams
     */
Authenticate user login request
@param array $formParams
Authenticate user login request @param array $formParams
private function authenticate(array $formParams) {
        $userDetail = $this->getModel()->getUserDetailsByName($formParams['username']);
        if (!empty($userDetail)) {
            if ($userDetail[Users_DBTable::IS_ACTIVE] == '1') {
                $passwordInDB = $userDetail[Users_DBTable::USER_HASH];
                $passwordHash = $this->getPasswordHash($formParams['password']);
                if ($passwordInDB === $passwordHash) {
                    if ($this->createUserSession($userDetail, $formParams['remember'])) {
                        Response::sendResponse(Constants::SUCCESS_RESPONSE, Messages::SUCCESS_LOGIN);
                        Logger::getLogger()->LogInfo("Auth Success for userid: ".$formParams['username']);
                    }
                } else {
                    Logger::getLogger()->LogDebug("Auth Failed [Invalid password] for userid: ".$formParams['username']);
                    Response::sendResponse(Constants::FAILURE_RESPONSE, Messages::ERROR_AUTH_INVALID_PASSWORD);
                }
            } else {
                Logger::getLogger()->LogDebug("Auth Failed [User Inactive] for userid: ".$formParams['username']);
                Response::sendResponse(Constants::FAILURE_RESPONSE, Messages::ERROR_AUTH_USER_INACTIVE);
            }
        } else {
            Logger::getLogger()->LogDebug("Auth Failed [Invalid Username] for userid: ".$formParams['username']);
            Response::sendResponse(Constants::FAILURE_RESPONSE, Messages::ERROR_AUTH_INVALID_USER_NAME);
        }
    }
private function authenticate ( array $ formParams ) { $ userDetail = $ this -> getModel ( ) -> getUserDetailsByName ( $ formParams [ 'username' ] ) ; if ( ! empty ( $ userDetail ) ) { if ( $ userDetail [ Users_DBTable :: IS_ACTIVE ] == '1' ) { $ passwordInDB = $ userDetail [ Users_DBTable :: USER_HASH ] ; $ passwordHash = $ this -> getPasswordHash ( $ formParams [ 'password' ] ) ; if ( $ passwordInDB === $ passwordHash ) { if ( $ this -> createUserSession ( $ userDetail , $ formParams [ 'remember' ] ) ) { Response :: sendResponse ( Constants :: SUCCESS_RESPONSE , Messages :: SUCCESS_LOGIN ) ; Logger :: getLogger ( ) -> LogInfo ( " Auth Success for userid:  " . $ formParams [ 'username' ] ) ; } } else { Logger :: getLogger ( ) -> LogDebug ( " Auth Failed [Invalid password] for userid:  " . $ formParams [ 'username' ] ) ; Response :: sendResponse ( Constants :: FAILURE_RESPONSE , Messages :: ERROR_AUTH_INVALID_PASSWORD ) ; } } else { Logger :: getLogger ( ) -> LogDebug ( " Auth Failed [User Inactive] for userid:  " . $ formParams [ 'username' ] ) ; Response :: sendResponse ( Constants :: FAILURE_RESPONSE , Messages :: ERROR_AUTH_USER_INACTIVE ) ; } } else { Logger :: getLogger ( ) -> LogDebug ( " Auth Failed [Invalid Username] for userid:  " . $ formParams [ 'username' ] ) ; Response :: sendResponse ( Constants :: FAILURE_RESPONSE , Messages :: ERROR_AUTH_INVALID_USER_NAME ) ; } }
Authenticate user login request
 @param array $formParams
Authenticate user login request @param array $formParams