コード例 #1
0
ファイル: Ajax.php プロジェクト: piotrazsko/accounting
 public function action_new_password()
 {
     if (Request::initial()->is_ajax()) {
         //смена  пароля
         $config = Kohana::$config->load('email');
         Email::connect($config);
         $subject = 'Востановление пароля';
         $from = '*****@*****.**';
         $email = Arr::get($_POST, 'email', '');
         $to = $email;
         $password1 = Arr::get($_POST, 'password1', '');
         $password2 = Arr::get($_POST, 'password2', '');
         $message = 'Ваш новый пароль : ' . $password1;
         $ajax = new Model_Stanki();
         $res = $ajax->new_password($email, $password1, $password2);
         if ($res == $email) {
             Email::send($res, $from, $subject, $message, $html = false);
             echo 'Изменено';
         } else {
             echo 'Ошибка! Проверьте введенный E-mail';
         }
     }
 }