/** * */ public function process_reset_password() { if (!class_exists('Member_auth')) { require PATH_MOD . 'member/mod.member_auth.php'; } $MA = new Member_auth(); foreach (get_object_vars($this) as $key => $value) { $MA->{$key} = $value; } return $MA->process_reset_password(); }
/** * check_login * * @param * @return */ public function member_member_login_single() { // in case we need to log things ee()->load->library('logger'); // how many logins allowed $logins = $this->settings['logins']; // Calculate time $now = ee()->localize->now; // Calculate interval $interval = $this->settings['every']; // interval will be in seconds if ($this->settings['unit'] == 'minute') { $interval = $interval * 60; } // minutes if ($this->settings['unit'] == 'hour') { $interval = $interval * 60 * 60; } // hours if ($this->settings['unit'] == 'day') { $interval = $interval * 60 * 60 * 24; } // days // Either way, add the login to the table $data = array('member_id' => ee()->session->userdata('member_id'), 'site_id' => ee()->config->item('site_id'), 'login_date' => ee()->localize->now); ee()->db->insert('limit_login', $data); // superadmins can always login; don't bother checking if (ee()->session->userdata('group_id') != 1) { // Look up logins in that time period ee()->db->where('login_date >', $now - $interval); ee()->db->where('member_id', ee()->session->userdata('member_id')); ee()->db->where('site_id', ee()->config->item('site_id')); $count = ee()->db->count_all_results('limit_login'); // Decide if you should log the person out if ($count > $logins) { ee()->logger->log_action('Login denied to member_id ' . ee()->session->userdata('member_id') . ' who has logged in ' . $count . ' times'); ee()->session->cache['limit_login']['limit'] = $count; // count is always bigger than one, right? // Log them out if (!class_exists('Member_auth')) { require PATH_MOD . 'member/mod.member_auth.php'; } $MA = new Member_auth(); $MA->member_logout(); // Note: when logout is forced, the rest of this never runs, I think. } } // Sometimes you should prune the table $expire = time() - $interval - 1; srand(time()); if (rand() % 100 < ee()->session->gc_probability) { ee()->db->where('login_date <', $expire)->delete('limit_login'); } return; }