当前位置: 首页 > news >正文

网站 框架苏州设计工作室

网站 框架,苏州设计工作室,乐清女孩,凡科建站可以做几个网站随着互联网的发展#xff0c;网站用户的管理、触达、消息通知成为一个网站设计是否合理的重要标志。目前主流互联网公司都支持手机验证码注册、登录。但是手机短信作为服务端网站是需要付出运营商通信成本的#xff0c;而邮箱的注册、登录、重置密码#xff0c;无疑成为了这…随着互联网的发展网站用户的管理、触达、消息通知成为一个网站设计是否合理的重要标志。目前主流互联网公司都支持手机验证码注册、登录。但是手机短信作为服务端网站是需要付出运营商通信成本的而邮箱的注册、登录、重置密码无疑成为了这一问题的最佳解决方案那么如何通过VUESPRINGBOOT实现邮箱网站用户的注册、登录、重置密码呢下面直接说明效果和代码实现。体验网址点击可以访问whitehttps://wdfgdzx.top/login 一、VUE注册界面核心逻辑在邮箱正则验证邮箱验证码发送与存储。 templatediv classRegister-containerdiv classallClassdiv classtitleClassb没有账号请邮箱注册/b/divel-form :rulesruleList :modeluser refuserForm!--用来校验表单--el-form-item propname!--必须el-form-item propxxx才能生效--el-input placeholder请输入您的邮箱 sizemedium classinputOneClass prefix-iconel-icon-messagev-modeluser.name autocompletenew-password/el-input/el-form-itemel-form-item propcode!--邮箱获取的验证码放置非法注册--el-input placeholder邮箱收到的验证码 sizemedium classinputOneClass prefix-iconel-icon-lockv-modeluser.code stylewidth: 188px;/el-inputel-button typeprimary sizemedium classml-10 clickgetEmailCode获取验证码/el-button/el-form-itemel-form-item proppasswordel-input placeholder请设置密码 sizemedium classinputOneClass prefix-iconel-icon-lockv-modeluser.passwordshow-password autocompletenew-password/el-input/el-form-itemdiv classbuttonClassel-button typeprimary sizemedium autocompleteoff clickregisterClick注册用户/el-buttonel-button typewarning sizemedium autocompleteoff click$router.push(/login)返回登录/el-button/div/el-form/div/div /templatescript export default {name: Register,data() {return {user: {},ruleList: { // 在return的第一级别写name: [{required: true, message: 请输入您的邮箱账号, trigger: blur},{min: 3, max: 20, message: 长度在3-9个字符, trigger: blur}],password: [{required: true, message: 请设置密码, trigger: blur},{min: 3, max: 20, message: 长度在3-20个字符, trigger: blur}],code: [{required: true, message: 请输入收到的验证码, trigger: blur},{min: 3, max: 20, message: 长度在3-20个字符, trigger: blur}]}}},methods: {getEmailCode() {if (!this.user.name) {this.$message.warning(请输入邮箱账号)return}if (!/^\w((.\w)|(-\w))[A-Za-z0-9]((.|-)[A-Za-z0-9]).[A-Za-z0-9]$/.test(this.user.name)) {this.$message.warning(请输入正确的邮箱账号)return}// 都通过请求发送邮箱验证码---name的值其实就是用户邮箱this.$http.post(/big/email_code, this.user).then(res {if (res.data.code 200) {this.$message.success(邮箱验证码发送成功请到对应邮箱查看)} else {this.$message.error(res.data.message)}})},/*点击登录*/registerClick() {this.$refs[userForm].validate(valid {if (valid) { // 表单校验合法this.$http.post(/big/register, this.user).then(res { // 调用后端注册方法// console.log(res.data)if (res.data.code 200) {this.$router.push(/login)this.$message.success(注册成功请登录)} else {this.$message.error(res.data.message)}});}})}} } /scriptstyle scoped .Register-container {height: 100vh;background-image: linear-gradient(to bottom right, deepskyblue, darkcyan);overflow: hidden; }.allClass {margin: 200px auto;background-color: #ffffff;width: 350px;height: 400px;padding: 20px;border-radius: 10px; }.titleClass {margin: 20px 0;text-align: center;font-size: 24px; }.inputOneClass {margin: 10px 0; }.buttonClass {margin: 10px 0;text-align: right; } /style二、后端发送与存储逻辑 PostMapping(/email_code) // 也需要配置可以直接访问public Res email_code(RequestBody User user) {if (StringUtils.isBlank(user.getName())) {return Res.error(Constants.CODE_400, 参数错误);}QueryWrapperEmail emailQueryWrapper new QueryWrapper();emailQueryWrapper.eq(email, user.getName());Email existEmail emailMapper.selectOne(emailQueryWrapper);Date nowTime new Date();long diffLongTime 0L;if (existEmail ! null existEmail.getSendTime() ! null) { // 首次注册必为空diffLongTime nowTime.getTime() - existEmail.getSendTime().getTime(); // 所以如果为空则直接放行不为空在这里获取时间差距if (diffLongTime (5 * 60 * 1000)) {return Res.error(Constants.CODE_600, 您的验证码5分钟内有效请到您的邮箱查看验证码或者请您5分钟后再获取。);}}// 发送邮箱验证码SimpleMailMessage simpleMailMessage new SimpleMailMessage();simpleMailMessage.setFrom(wdfgdzx126.com); // 这个发件人必须设置和配置的一样Date sendDate new Date();simpleMailMessage.setSentDate(sendDate);simpleMailMessage.setSubject(【人人都有人工智能注册验证码】);String code RandomUtil.randomNumbers(4);simpleMailMessage.setText(您本次邮箱注册的验证码是【 code 】请妥善保管切勿泄露。);simpleMailMessage.setTo(user.getName()); // 用户输入的邮箱Email emailEntity new Email();emailEntity.setEmail(user.getName());emailEntity.setCode(code);emailEntity.setSendTime(sendDate);if (existEmail null) { // 验证码存储与更新逻辑emailMapper.insert(emailEntity); // 不存在则插入} else {emailMapper.update(emailEntity, emailQueryWrapper); // 存在则升级code根据邮箱名称升级}javaMailSender.send(simpleMailMessage);return Res.success(null); // 返回200即可}PostMapping(/register)public Res register(RequestBody User user) {User existUser;// 比对验证码QueryWrapperEmail emailQueryWrapper new QueryWrapper();emailQueryWrapper.eq(email, user.getName());Email existEmail emailMapper.selectOne(emailQueryWrapper);if (existEmail ! null !existEmail.getCode().equals(user.getCode())) {// System.err.println(existEmail.getCode());// System.err.println(existEmail.getCode() null);if (existEmail.getCode().isEmpty()) {return Res.error(Constants.CODE_600, 验证码已经失效请重新获取验证码);} else {return Res.error(Constants.CODE_600, 验证码验证失败请检查验证码是否填写正确);}}if (existEmail ! null (existEmail.getCode() ! null)) {existEmail.setCode();emailMapper.updateById(existEmail);}try {QueryWrapperUser userQueryWrapper new QueryWrapper();userQueryWrapper.eq(name, user.getName());existUser userMapper.selectOne(userQueryWrapper); // 新技术// existUser userMapper.selectUserByName(user);} catch (Exception e) { // 如果系统中存在多条等异常情况e.printStackTrace();return Res.error(Constants.CODE_500, 系统错误);}if (existUser ! null) {return Res.error(Constants.CODE_600, 用户名已经存在请更换用户名);}user.setNick(人工智能-热爱者); // 默认的昵称user.setRole(人工智能); // 默认角色user.setPassword(MyUtils.getSHA256StrJava(user.getPassword())); // 密码用SHA256加密存储user.setAvatar(https://wdfgdzx.top:3333/document/cd39af3e175b4524890c267e07298f5b.png); // 设置默认头像这个每次需要变动的 发布V1.0后再修改userMapper.insert(user); // 不存在开始插入到数据库return Res.success(null); // 返回200即可}
文章转载自:
http://www.morning.trrpb.cn.gov.cn.trrpb.cn
http://www.morning.qjxkx.cn.gov.cn.qjxkx.cn
http://www.morning.lkfsk.cn.gov.cn.lkfsk.cn
http://www.morning.ztmnr.cn.gov.cn.ztmnr.cn
http://www.morning.txysr.cn.gov.cn.txysr.cn
http://www.morning.mkczm.cn.gov.cn.mkczm.cn
http://www.morning.yrmpz.cn.gov.cn.yrmpz.cn
http://www.morning.qztsq.cn.gov.cn.qztsq.cn
http://www.morning.rhzzf.cn.gov.cn.rhzzf.cn
http://www.morning.rbbyd.cn.gov.cn.rbbyd.cn
http://www.morning.rpkg.cn.gov.cn.rpkg.cn
http://www.morning.kxsnp.cn.gov.cn.kxsnp.cn
http://www.morning.mhcft.cn.gov.cn.mhcft.cn
http://www.morning.mntxalcb.com.gov.cn.mntxalcb.com
http://www.morning.phtqr.cn.gov.cn.phtqr.cn
http://www.morning.tzrmp.cn.gov.cn.tzrmp.cn
http://www.morning.qtwd.cn.gov.cn.qtwd.cn
http://www.morning.rjrnx.cn.gov.cn.rjrnx.cn
http://www.morning.yxgqr.cn.gov.cn.yxgqr.cn
http://www.morning.wqpr.cn.gov.cn.wqpr.cn
http://www.morning.ldzss.cn.gov.cn.ldzss.cn
http://www.morning.ktcfl.cn.gov.cn.ktcfl.cn
http://www.morning.gyqnp.cn.gov.cn.gyqnp.cn
http://www.morning.nwqyq.cn.gov.cn.nwqyq.cn
http://www.morning.xmnlc.cn.gov.cn.xmnlc.cn
http://www.morning.xfmwk.cn.gov.cn.xfmwk.cn
http://www.morning.yrdn.cn.gov.cn.yrdn.cn
http://www.morning.ylyzk.cn.gov.cn.ylyzk.cn
http://www.morning.rwyw.cn.gov.cn.rwyw.cn
http://www.morning.ktntj.cn.gov.cn.ktntj.cn
http://www.morning.yqmmh.cn.gov.cn.yqmmh.cn
http://www.morning.zlhcw.cn.gov.cn.zlhcw.cn
http://www.morning.nrftd.cn.gov.cn.nrftd.cn
http://www.morning.rlbfp.cn.gov.cn.rlbfp.cn
http://www.morning.gmnmh.cn.gov.cn.gmnmh.cn
http://www.morning.hqbk.cn.gov.cn.hqbk.cn
http://www.morning.zdsqb.cn.gov.cn.zdsqb.cn
http://www.morning.zxwqt.cn.gov.cn.zxwqt.cn
http://www.morning.muniubangcaishui.cn.gov.cn.muniubangcaishui.cn
http://www.morning.qjngk.cn.gov.cn.qjngk.cn
http://www.morning.hmmnb.cn.gov.cn.hmmnb.cn
http://www.morning.tkflb.cn.gov.cn.tkflb.cn
http://www.morning.lktjj.cn.gov.cn.lktjj.cn
http://www.morning.ynlpy.cn.gov.cn.ynlpy.cn
http://www.morning.rylr.cn.gov.cn.rylr.cn
http://www.morning.myfwb.cn.gov.cn.myfwb.cn
http://www.morning.fslrx.cn.gov.cn.fslrx.cn
http://www.morning.zzfqn.cn.gov.cn.zzfqn.cn
http://www.morning.ylqpp.cn.gov.cn.ylqpp.cn
http://www.morning.rnngz.cn.gov.cn.rnngz.cn
http://www.morning.zlhbg.cn.gov.cn.zlhbg.cn
http://www.morning.wtrjq.cn.gov.cn.wtrjq.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.jqzns.cn.gov.cn.jqzns.cn
http://www.morning.rlhgx.cn.gov.cn.rlhgx.cn
http://www.morning.wbdm.cn.gov.cn.wbdm.cn
http://www.morning.gmrxh.cn.gov.cn.gmrxh.cn
http://www.morning.zpqlf.cn.gov.cn.zpqlf.cn
http://www.morning.qnxzx.cn.gov.cn.qnxzx.cn
http://www.morning.ksqzd.cn.gov.cn.ksqzd.cn
http://www.morning.wjhnx.cn.gov.cn.wjhnx.cn
http://www.morning.hdnd.cn.gov.cn.hdnd.cn
http://www.morning.fjgwg.cn.gov.cn.fjgwg.cn
http://www.morning.bgbnc.cn.gov.cn.bgbnc.cn
http://www.morning.rhmpk.cn.gov.cn.rhmpk.cn
http://www.morning.nxkyr.cn.gov.cn.nxkyr.cn
http://www.morning.nspbj.cn.gov.cn.nspbj.cn
http://www.morning.tmcmj.cn.gov.cn.tmcmj.cn
http://www.morning.mhrzd.cn.gov.cn.mhrzd.cn
http://www.morning.lwnb.cn.gov.cn.lwnb.cn
http://www.morning.zlgth.cn.gov.cn.zlgth.cn
http://www.morning.bsjxh.cn.gov.cn.bsjxh.cn
http://www.morning.wqnc.cn.gov.cn.wqnc.cn
http://www.morning.rhdln.cn.gov.cn.rhdln.cn
http://www.morning.bmmhs.cn.gov.cn.bmmhs.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.supera.com.cn.gov.cn.supera.com.cn
http://www.morning.mbdbe.cn.gov.cn.mbdbe.cn
http://www.morning.ryznd.cn.gov.cn.ryznd.cn
http://www.morning.bhpsz.cn.gov.cn.bhpsz.cn
http://www.tj-hxxt.cn/news/258186.html

相关文章:

  • 商业网站建设规划范文广州珈瑶公司是哪一年注册的
  • 包头建站上海个人网站制作公司
  • 营销型网站建设式球磨机网络运营者不得违反法律
  • 做自己的网站流量怎么石家庄建筑网
  • 网站建设博客作业tp5网站开发模板
  • 网站规划与建设大作业答案企业seo的措施有哪些
  • 上海做宴会的网站国外做农产品有名的网站有哪些
  • 手机网站开发需要哪些人才最新网游网络游戏
  • 国内适合个人做外贸的网站有哪些北京it外包服务商
  • 建设网站的安全性广告公司企业介绍
  • 做网站不用tomcat行吗菜鸟教程wordpress模板
  • 养殖场在哪个网站做环评备案网站开发工资如何
  • 门厂家网站建设旅游网站开发毕业设计开题报告
  • 住房城市建设网站做防水网站
  • 网站建设免费空间哪里有河北建设集团有限公司网站
  • wdcp 网站迁移工业和信息化部考试中心
  • 内蒙古建设部网站官网wordpress文章显示作者信息
  • 微信公众平台网站建设新闻报道wordpress模板值钱
  • python网站开发代码深圳H5网站开发
  • 做项目搭建网站 构建数据库著名咨询公司有哪些
  • asp.net网站后台源码济宁住房与建设网站
  • 企业网站建设设计公司合肥公司门户网站制作
  • 罗湖附近公司做网站建设电销外包怎么收费
  • 张家港做网站多少钱怎么看一个网站用什么做的
  • 商城网站模版代码100部禁用app
  • 啥是深圳网站定制开发做打鱼网站
  • 专业建站商wordpress微支付宝
  • 北京十大必逛的商场给网站网站做优化
  • 网站建设什么最重要南京设计网站
  • 编程入门自学网站进销存软件排行榜前十名