protected function getUserSelect($login_name, $organization)
    {
        if ((0 == ($this->hoursResetKeyIsValid % 24)) || \Zend_Session::$_unitTestEnabled) {
            $resetExpr = 'CASE WHEN ADDDATE(gup_reset_requested, ' .
                    intval($this->hoursResetKeyIsValid / 24) .
                    ') >= CURRENT_TIMESTAMP THEN 1 ELSE 0 END';
        } else {
            $resetExpr = 'CASE WHEN DATE_ADD(gup_reset_requested, INTERVAL ' .
                    $this->hoursResetKeyIsValid .
                    ' HOUR) >= CURRENT_TIMESTAMP THEN 1 ELSE 0 END';
        }

        // 'user_group'       => 'gsf_id_primary_group', 'user_logout'      => 'gsf_logout_on_survey',
        $select = new \Zend_Db_Select($this->db);
        $select->from('gems__user_logins', array(
                    'user_login_id'       => 'gul_id_user',
                    'user_two_factor_key' => 'gul_two_factor_key',
                    'user_enable_2factor' => 'gul_enable_2factor',
                    'user_active'         => 'gul_can_login',
                    ))
                ->join('gems__respondent2org', 'gul_login = gr2o_patient_nr AND gul_id_organization = gr2o_id_organization', array(
                    'user_login'       => 'gr2o_patient_nr',
                    'user_base_org_id' => 'gr2o_id_organization',
                    'user_email'       => 'gr2o_email',
                    ))
               ->join('gems__respondents', 'gr2o_id_user = grs_id_user', array(
                    'user_id'             => 'grs_id_user',
                    'user_first_name'     => 'grs_first_name',
                    'user_surname_prefix' => 'grs_surname_prefix',
                    'user_last_name'      => 'grs_last_name',
                    'user_gender'         => 'grs_gender',
                    'user_locale'         => 'grs_iso_lang',
                    'user_birthday'       => 'grs_birthday',
                    'user_zip'            => 'grs_zipcode',
                    ))
               ->join('gems__organizations', 'gr2o_id_organization = gor_id_organization', array(
                    'user_group' => 'gor_respondent_group',
                    ))
                ->join('gems__groups', 'gor_respondent_group = ggp_id_group', array(
                    'user_role'              => 'ggp_role',
                    'user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges',
                    ))
               ->joinLeft('gems__user_passwords', 'gul_id_user = gup_id_user', array(
                   'user_password_reset' => 'gup_reset_required',
                   'user_resetkey_valid' => new \Zend_Db_Expr($resetExpr),
                    'user_password_last_changed' => 'gup_last_pwd_change',
                  ))
               ->joinLeft('gems__reception_codes', 'gr2o_reception_code = grc_id_reception_code', array())
               ->where('ggp_group_active = 1')
               ->where('grc_success = 1')
               ->where('gul_can_login = 1')
               ->where('gul_login = ?')
               ->where('gul_id_organization = ?')
               ->limit(1);

        return $select;
    }