Exemplo n.º 1
0
 /**
  * 找回密码 第三步   邮箱跳转回来地址,设置密码页!
  * @param str $from = email 标识
  * @param str $msg 加密的用户信息
  *
  * @return 跳转
  */
 public function actionEmailPrompt()
 {
     //邮箱跳转回来地址
     $from = Yii::$app->request->get('from');
     if (Yii::$app->request->get('from') == 'email') {
         $msg = Yii::$app->request->get('msg');
         if (empty($msg)) {
             echo "<script>alert('地址有误!'),window.location.href='" . Url::toRoute('user/find-password') . "';</script>";
             exit;
         }
         $content = PublicLibrary::pwfindUrl($msg, true);
         $Member_model = new Member();
         $userone = $Member_model->getByUserName($content['username']);
         $now = time();
         if ($userone['password'] == $content['password'] && $content['outtime'] > $now) {
             $checkkey = PublicLibrary::setKey();
             if (PublicLibrary::is_ajax()) {
                 $this->layout = false;
                 echo $this->render('ajax_setpassword', ['checkkey' => $checkkey, 'username' => $content['username'], 'from' => 'email']);
                 exit;
             } else {
                 return $this->render('setpassword', ['checkkey' => $checkkey, 'username' => $content['username'], 'from' => 'email']);
                 exit;
             }
         } else {
             echo "<script>alert('验证链接已过期,请重新操作!'),window.location.href='" . Url::toRoute('user/find-password') . "';</script>";
         }
     }
 }