ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 发送邮件 # *D:\wamp\www\ketang.test\weike\protected\service\IdentityService.php* ``` /** * 获取课堂邮件发送文本 * @param $code * @param $userID * @param $email * @param $type * @return string * @author wuzhc 2016-01-08 */ private function _getEmailTempleForKetang($code,$userID,$email,$type) { $codeMd5 = md5($code) ; switch($type) { case WK::FIND_BY_EMAIL: $title = '找回密码'; // $url = Yii::app()->request->hostInfo.Yii::app()->createUrl('/user/getPwd',array('code'=>$codeMd5, 'email'=>$email, 'userId' => $userID, 'isFromEmail' => 'true')); $url = Yii::app()->request->hostInfo.Yii::app()->createUrl('/user/getUserPwd',array('code'=>$codeMd5, 'email'=>$email, 'userId' => $userID, 'isFromEmail' => 'true')); //by chenxch break; case WK::BIND_BY_EMAIL: $title = '绑定邮箱'; $url = Yii::app()->request->hostInfo.Yii::app()->createUrl('/ktUser/clickBindEmail',array('code'=>$codeMd5, 'email'=>$email, 'userId' => $userID)); break; case WK::REMOVE_BY_EMAIL: $title = '解绑邮箱'; $url = Yii::app()->request->hostInfo.Yii::app()->createUrl('/ktUser/removeEmail',array('code'=>$codeMd5, 'email'=>$email, 'userId' => $userID,'from' => 'true')); break; default: return ''; } $userName = $userID ? UserService::factory()->getShowName($userID) : "用户"; $content = ''; $content .= '标题:'.$title.'<br/>'; $content .= '尊敬的'.$userName.',您好!<br/><br/>'; $content .= '您已使用了未名教育'.$title.'功能,请点击以下链接<br/>'.$title; $content .= '<a href="'.$url.'">点击'.$title.'</a><br/>'; $content .= '或输入验证码:'.$code.'<br/>'; $content .= '如果不能点击该链接地址,请复制并粘贴到浏览器的地址输入框:<br/>'; $content .= $url.'<br/><br/>'; $content .= '未名教育<br/>'; $content .= date("Y-m-d H:i:s", time()).'<br/>(请勿回复该邮件)'; return $content; } ``` ## 重置邮件页面 *D:\wamp\www\ketang.test\weike\protected\views\version2\user\resetUserPwd.php* ``` $("#submit_pwd").click(function(){//重置密码 var _pwd = $("#input_pwd").val(); var _repwd = $("#input_repwd").val(); var from = '<?php echo $isFromEmail?"email":($isFromPhone?"phone":"");?>'; var new_pwd = newpwdjudge(_pwd,$("#input_pwd").next()); var renew_pwd = renewpwdjudge(_repwd,_pwd,$("#input_repwd").next()); if(new_pwd && renew_pwd){ $.post("/?r=user/resetPwd", { password: $.md5(_pwd), userId:"<?php echo $userId;?>" , code: "<?php echo $code;?>",from: from }, function(msg){ if(msg=="paramError"){ $.showBox("参数错误"); }else if(msg=="success"){ $.showBox("密码修改成功"); window.location.href = "<?php echo $this->createUrl("/");?>"; }else if(msg=="error"){ $.showBox("密码修改失败"); }else if(msg=="login"){ $.showBox("请退出登录后再重新操作"); }else{ $.showBox("系统繁忙,请稍后再试"); } }); } }); ``` ## 手机验证修改密码 http://ketang311.wm3dao.com/?r=user/sendPhoneResetPwd&time=0.43934399796935186