public static function trackActor($email, $action, $properties = array()) { if (class_exists('\\Activity\\Models\\Actions')) { \Activity\Models\Actions::trackActor($email, $action, $properties); } if (class_exists('\\Admin\\Models\\Settings') && class_exists('\\KM')) { $settings = \Admin\Models\Settings::fetch(); if ($settings->enabledIntegration('kissmetrics') && $settings->{'integration.kissmetrics.key'}) { \KM::init($settings->{'integration.kissmetrics.key'}); \KM::identify($email); \KM::record($action, $properties); } } return null; }
function authenticate($data) { if ($data === false) { $this->destroyData(); return false; } if ($this->from_session || $this->from_cookie) { $hashed_password = $data['password']; // Does not re-hash the password (saving time because the hashed password is in the Session) } else { $hashed_password = $this->hasher($data['password']); } switch ($this->user_name_case_folding) { case 'lower': $data['username'] = strtolower($data['username']); break; case 'upper': $data['username'] = strtoupper($data['username']); break; default: break; } $conditions = array($this->user_model_name . "." . $this->user_name_field => $data['username'], $this->user_model_name . "." . $this->user_pass_field => $hashed_password); if ($this->user_live_field) { $field = $this->user_model_name . "." . $this->user_live_field; $conditions[$field] = $this->user_live_value; } $this->controller->{$this->user_model_name}->contain(array('Profile', $this->group_model_name)); $check = $this->controller->{$this->user_model_name}->find($conditions); if ($check) { $this->Session->write($this->secure_key(), $check); if ($this->allow_cookie && $this->from_post && array_key_exists('remember_me', $data) && $data['remember_me'] == true) { // set our cookie! if (array_key_exists('cookie_expiry', $data)) { $this->cookie_expiry = $data['cookie_expiry']; } else { $this->cookie_expiry; } if (strtotime($this->cookie_expiry) <= time()) { // Session cookie? might as well not set at all... } else { $expiry = strtotime($this->cookie_expiry); $this->setCookieInfo(array('username' => $data['username'], 'password' => $hashed_password, 'expiry' => $expiry), $expiry); } } $this->current_user = $check; $this->li = true; $this->id = $check[$this->user_model_name]['id']; // Initialize Kiss Metrics identity KM_init(); KM::identify($check[$this->user_model_name]['email']); // Must be on the correct site // - unless they are admin /* if($check['User']['role_id'] == 3){ // Admin, do not redirect } else { if(strtolower($check['User']['work_state']) == 'ca'){ // Must be on PDC if(IDC_PDC != 'pdc'){ $this->controller->redirect(PDC_BASE_URL); } } else { // Must be on IDC if(IDC_PDC != 'idc'){ $this->controller->redirect(IDC_BASE_URL); } } } */ return true; } else { if ($this->from_post) { //$this->Session->setFlash($this->login_failed_message); return false; } $this->destroyData(); return false; } }