Esempio n. 1
0
 public function __construct()
 {
     $this->confirmation_code = \FA\Legacy\Utilities::uuid();
     $this->ip = $_SERVER['REMOTE_ADDR'];
     $this->created_at = time();
     $this->is_used = false;
 }
Esempio n. 2
0
 public function indexAction()
 {
     $form = new \FA\Form($this->current_module_config->forms->recover);
     if ($_POST && $form->isValid($_POST)) {
         $data = $form->getValues();
         $data['email'] = mb_strtolower($data['email'], 'UTF-8');
         $user = User::getRepository()->findOneBy(array('username' => $data['username'], 'email' => $data['email']));
         if ($user instanceof User) {
             $user->lostpw = \FA\Legacy\Utilities::uuid();
             $user->save();
             \FA\Messenger::send(array('to' => $user->email, 'subject' => 'Password Recovery Code', 'template' => 'account_recover', 'vars' => array('id' => $user->id, 'code' => $user->lostpw)));
             $this->alert('<b>A password recovery link has been sent to your e-mail address.</b><br>Click the link in the e-mail to reset your password.', 'green');
             return $this->redirectHome();
         } else {
             $form->addError('username', 'We could not locate an account with this username and e-mail address in our system. Please try again!');
         }
     }
     $this->view->setVar('title', 'Forgot My Password');
     return $this->renderForm($form);
 }
Esempio n. 3
0
 public function setThumbnail($new_path)
 {
     // Delete existing file (if exists).
     if (!empty($this->thumbnail)) {
         @unlink(self::getFilePath($this->thumbnail));
     }
     $this->thumbnail = self::cleanUpBasePath($new_path);
     $this->thumbnail_uuid = \FA\Legacy\Utilities::uuid();
 }