Ejemplo n.º 1
0
 public function ResetPassword()
 {
     $email = $this->post->email;
     if (!$email) {
         return false;
     } else {
         $pilot = PilotData::GetPilotByEmail($email);
         if (!$pilot) {
             $this->render('login_notfound.tpl');
             return;
         }
         $newpw = substr(md5(date('mdYhs')), 0, 6);
         RegistrationData::ChangePassword($pilot->pilotid, $newpw);
         $this->set('firstname', $pilot->firstname);
         $this->set('lastname', $pilot->lastname);
         $this->set('newpw', $newpw);
         $message = Template::GetTemplate('email_lostpassword.tpl', true);
         Util::SendEmail($pilot->email, 'Password Reset', $message);
         $this->render('login_passwordreset.tpl');
     }
 }
Ejemplo n.º 2
0
 protected function change_password_post()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     // Verify
     if ($this->post->oldpassword == '') {
         $this->set('message', 'You must enter your current password');
         $this->render('core_error.tpl');
         return;
     }
     if ($this->post->password1 != $this->post->password2) {
         $this->set('message', 'Your passwords do not match');
         $this->render('core_error.tpl');
         return;
     }
     // Change
     $hash = md5($this->post->oldpassword . Auth::$userinfo->salt);
     if ($hash == Auth::$userinfo->password) {
         RegistrationData::ChangePassword(Auth::$pilotid, $_POST['password1']);
         $this->set('message', 'Your password has been reset');
     } else {
         $this->set('message', 'You entered an invalid password');
     }
     $this->render('core_success.tpl');
 }
Ejemplo n.º 3
0
 protected function ChangePassword()
 {
     $password1 = $this->post->password1;
     $password2 = $this->post->password2;
     // Check password length
     if (strlen($password1) <= 5) {
         $this->set('message', Lang::gs('password.wrong.length'));
         $this->render('core_message.tpl');
         return;
     }
     // Check is passwords are the same
     if ($password1 != $password2) {
         $this->set('message', Lang::gs('password.no.match'));
         $this->render('core_message.tpl');
         return;
     }
     RegistrationData::ChangePassword($this->post->pilotid, $password1);
     if (DB::errno() != 0) {
         $this->set('message', 'There was an error, administrator has been notified');
         $this->render('core_error.tpl');
     } else {
         $this->set('message', Lang::gs('password.changed'));
         $this->render('core_success.tpl');
     }
     $pilot = PilotData::getPilotData($this->post->pilotid);
     LogData::addLog(Auth::$userinfo->pilotid, 'Changed the password for ' . PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' - ' . $pilot->firstname . ' ' . $pilot->lastname);
 }