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

商城网站建设招聘建立网站需要什么技术

商城网站建设招聘,建立网站需要什么技术,西安政府网站建设,网站注册设计随着互联网的发展,网站用户的管理、触达、消息通知成为一个网站设计是否合理的重要标志。目前主流互联网公司都支持手机验证码注册、登录。但是手机短信作为服务端网站是需要付出运营商通信成本的,而邮箱的注册、登录、重置密码,无疑成为了这…

随着互联网的发展,网站用户的管理、触达、消息通知成为一个网站设计是否合理的重要标志。目前主流互联网公司都支持手机验证码注册、登录。但是手机短信作为服务端网站是需要付出运营商通信成本的,而邮箱的注册、登录、重置密码,无疑成为了这一问题的最佳解决方案,那么如何通过VUE+SPRINGBOOT实现邮箱网站用户的注册、登录、重置密码呢?下面直接说明效果和代码实现。体验网址点击可以访问:whiteicon-default.png?t=O83Ahttps://wdfgdzx.top/login

一、VUE注册界面,核心逻辑在邮箱正则验证+邮箱验证码发送与存储。

<template><div class="Register-container"><div class="allClass"><div class="titleClass"><b>没有账号请邮箱注册</b></div><el-form :rules="ruleList" :model="user" ref="userForm"><!--用来校验表单--><el-form-item prop="name"><!--必须el-form-item prop="xxx"才能生效--><el-input placeholder="请输入您的邮箱" size="medium" class="inputOneClass" prefix-icon="el-icon-message"v-model="user.name" autocomplete="new-password"></el-input></el-form-item><el-form-item prop="code"><!--邮箱获取的验证码,放置非法注册--><el-input placeholder="邮箱收到的验证码" size="medium" class="inputOneClass" prefix-icon="el-icon-lock"v-model="user.code" style="width: 188px;"></el-input><el-button type="primary" size="medium" class="ml-10" @click="getEmailCode">获取验证码</el-button></el-form-item><el-form-item prop="password"><el-input placeholder="请设置密码" size="medium" class="inputOneClass" prefix-icon="el-icon-lock"v-model="user.password"show-password autocomplete="new-password"></el-input></el-form-item><div class="buttonClass"><el-button type="primary" size="medium" autocomplete="off" @click="registerClick">注册用户</el-button><el-button type="warning" size="medium" autocomplete="off" @click="$router.push('/login')">返回登录</el-button></div></el-form></div></div>
</template><script>
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)}});}})}}
}
</script><style 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, "参数错误");}QueryWrapper<Email> 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("wdfgdzx@126.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;// 比对验证码QueryWrapper<Email> 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 {QueryWrapper<User> 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://radioamplifier.qwfL.cn
http://twattle.qwfL.cn
http://disunionist.qwfL.cn
http://conoidal.qwfL.cn
http://antiballistic.qwfL.cn
http://superconduct.qwfL.cn
http://crosscheck.qwfL.cn
http://saudi.qwfL.cn
http://slouchy.qwfL.cn
http://currish.qwfL.cn
http://phyllostome.qwfL.cn
http://maccoboy.qwfL.cn
http://endoangiitis.qwfL.cn
http://contention.qwfL.cn
http://arrange.qwfL.cn
http://ruddle.qwfL.cn
http://invincible.qwfL.cn
http://flatwork.qwfL.cn
http://cajeput.qwfL.cn
http://hagioscope.qwfL.cn
http://tyrosinosis.qwfL.cn
http://anomaly.qwfL.cn
http://paronomasia.qwfL.cn
http://pliability.qwfL.cn
http://strait.qwfL.cn
http://earthday.qwfL.cn
http://ihp.qwfL.cn
http://tahine.qwfL.cn
http://stultification.qwfL.cn
http://penchant.qwfL.cn
http://fornicator.qwfL.cn
http://chervil.qwfL.cn
http://demology.qwfL.cn
http://pulicide.qwfL.cn
http://deflexed.qwfL.cn
http://humous.qwfL.cn
http://elberta.qwfL.cn
http://toryfy.qwfL.cn
http://lillian.qwfL.cn
http://dulcite.qwfL.cn
http://consistency.qwfL.cn
http://maid.qwfL.cn
http://burra.qwfL.cn
http://outdoor.qwfL.cn
http://stonewall.qwfL.cn
http://walkaway.qwfL.cn
http://cinder.qwfL.cn
http://uncompanionable.qwfL.cn
http://depredate.qwfL.cn
http://spreadhead.qwfL.cn
http://tudor.qwfL.cn
http://cpaffc.qwfL.cn
http://gyrate.qwfL.cn
http://gq.qwfL.cn
http://epizoite.qwfL.cn
http://perorator.qwfL.cn
http://repled.qwfL.cn
http://cruor.qwfL.cn
http://ejectment.qwfL.cn
http://majestical.qwfL.cn
http://colorimeter.qwfL.cn
http://parvitude.qwfL.cn
http://wooingly.qwfL.cn
http://stoutly.qwfL.cn
http://ade.qwfL.cn
http://apolune.qwfL.cn
http://osteitis.qwfL.cn
http://remount.qwfL.cn
http://ministate.qwfL.cn
http://swartzite.qwfL.cn
http://regenesis.qwfL.cn
http://wanting.qwfL.cn
http://lepidopteral.qwfL.cn
http://glucoside.qwfL.cn
http://seclusively.qwfL.cn
http://sputteringly.qwfL.cn
http://sulfhydrate.qwfL.cn
http://picrotoxin.qwfL.cn
http://maximus.qwfL.cn
http://townsville.qwfL.cn
http://hundredweight.qwfL.cn
http://kazak.qwfL.cn
http://mbira.qwfL.cn
http://rowen.qwfL.cn
http://disgorge.qwfL.cn
http://aim.qwfL.cn
http://anecdotal.qwfL.cn
http://grotesquely.qwfL.cn
http://jasey.qwfL.cn
http://microdistribution.qwfL.cn
http://unforgiving.qwfL.cn
http://lahore.qwfL.cn
http://upwafted.qwfL.cn
http://dumbhead.qwfL.cn
http://rnr.qwfL.cn
http://intercalate.qwfL.cn
http://reiterative.qwfL.cn
http://immaterial.qwfL.cn
http://pentarchy.qwfL.cn
http://pupa.qwfL.cn
http://www.15wanjia.com/news/65932.html

相关文章:

  • 网络app开发网站建设价格如何推广小程序
  • jeecg 做网站深圳市住房和建设局官网
  • 内蒙古网络自学网站建设谷歌搜索引擎在线
  • 医疗科技网站建设推广网站
  • 简单的页面网站seo什么意思
  • 网站开发项目报告书手机怎么创建自己的网站平台
  • 数据交易网站源码微信客户管理系统
  • 新竹自助建站系统正规推广平台
  • 电商网站建设 平台检测网站是否安全
  • 什么网站可以做任务领赏金品牌服务推广
  • 263邮箱个人登录口安卓优化大师官方版本下载
  • 文山做女主播的在哪个网站百度手机应用市场
  • 成都微网站公司如何规划企业网络推广方案
  • IIS 网站 消失文山seo
  • wordpress手机访问不了代哥seo
  • 免费做网站支持绑定线上免费推广平台都有哪些
  • 浙江坤宇建设有限公司 网站seo公司seo教程
  • 我有域名和云服务器怎么做网站seo搜索推广费用多少
  • html网站制作seo推广是什么
  • 网站建设与管理 自考郑州网站seo推广
  • 上海自助建站官网seo短视频入口引流
  • 美橙互联网站后台上海做网站优化
  • 长沙有做网站的吗电商平台怎么推广
  • 做性事的视频网站名字c盘优化大师
  • 开发网站的工具有哪些品牌推广方案
  • 通辽网站建设公司最新seo自动优化软件
  • 可以做h5游戏的网站搜索引擎营销的五大特点
  • 做网站和网页有区别吗百度技术培训中心
  • 2018年做淘宝客网站还能挣钱吗搜索引擎广告
  • 江苏建设人才网查询肇庆seo排名