Add email notifications

This commit is contained in:
Frédéric Guillot
2014-08-15 17:23:41 -07:00
parent c539bdc8ab
commit 9eeded33f6
240 changed files with 23410 additions and 308 deletions

View File

@@ -27,21 +27,19 @@ class Google extends Base
*/
public function authenticate($google_id)
{
$userModel = new User($this->db, $this->event);
$user = $userModel->getByGoogleId($google_id);
$user = $this->user->getByGoogleId($google_id);
if ($user) {
// Create the user session
$userModel->updateSession($user);
$this->user->updateSession($user);
// Update login history
$lastLogin = new LastLogin($this->db, $this->event);
$lastLogin->create(
$this->lastLogin->create(
LastLogin::AUTH_GOOGLE,
$user['id'],
$userModel->getIpAddress(),
$userModel->getUserAgent()
$this->user->getIpAddress(),
$this->user->getUserAgent()
);
return true;
@@ -59,9 +57,7 @@ class Google extends Base
*/
public function unlink($user_id)
{
$userModel = new User($this->db, $this->event);
return $userModel->update(array(
return $this->user->update(array(
'id' => $user_id,
'google_id' => '',
));
@@ -77,9 +73,7 @@ class Google extends Base
*/
public function updateUser($user_id, array $profile)
{
$userModel = new User($this->db, $this->event);
return $userModel->update(array(
return $this->user->update(array(
'id' => $user_id,
'google_id' => $profile['id'],
'email' => $profile['email'],