Esempio n. 1
0
 /**
  * Unblock an account
  *
  * @param $id
  * @return bool
  */
 public function unblockAccount($id)
 {
     $wasUnblocked = (bool) $this->account->update(array('id' => $id), array('status' => 'OK', 'availDt' => '0000-00-00 00:00:00'));
     if ($wasUnblocked) {
         $this->app['events']->fire('account.unblocked', array(array('account' => $id)));
     }
     return $wasUnblocked;
 }
Esempio n. 2
0
 /**
  * Generate a new deletion code and sends it to the email
  *
  * @param $user
  * @return bool
  * @throws DeletionCodeException
  */
 public function deletionCode($user)
 {
     $account = $this->account->findById($user);
     if (!$account) {
         throw new DeletionCodeException('This account doesn\'t exists');
     }
     $data = ['id' => $account['id'], 'email' => $account['email'], 'login' => $account['login'], 'deletionCode' => str_random(7)];
     $this->events->fire('account.deletion_code.before', array($data));
     $wasUpdated = $this->account->update(['id' => $user], ['social_id' => $data['deletionCode']]);
     if ($wasUpdated) {
         $this->events->fire('account.deletion_code.after', [$data]);
         $this->meta->set($user, 'deletion_last', Carbon::now());
         $this->accountMailer->deletionCode($data)->send();
     }
     return $wasUpdated;
 }
Esempio n. 3
0
 /**
  * Update the remember token
  *
  * @param Authenticatable $user
  * @param string $token
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     $this->account->update(['id' => $user->id], [$user->getRememberTokenName() => $token]);
 }