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

网站关键词代码知东莞app下载

网站关键词代码,知东莞app下载,信息门户网站建设合同,米拓做网站图片在哪里删掉一、SpringBoot集成邮箱验证码 二、SpringBoot集成阿里云短信服务(手机验证码) 1.配置类 2.那么如何获取配置信息呢? 一、SpringBoot集成邮箱验证码 首先我们来讲讲如何发生邮箱验证码,使用邮箱验证码的好处是不需要任何成本。 导入依赖 <!--引入发送邮件的坐标--…

 一、SpringBoot集成邮箱验证码

二、SpringBoot集成阿里云短信服务(手机验证码)

1.配置类

2.那么如何获取配置信息呢?


 一、SpringBoot集成邮箱验证码

首先我们来讲讲如何发生邮箱验证码,使用邮箱验证码的好处是不需要任何成本。

导入依赖

	<!--引入发送邮件的坐标--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId><version>2.7.13</version> <!-- 或者最新版本 --></dependency><!--引入redis坐标--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency>
spring:mail:host: smtp.qq.comport: 587 #端口username: ${email.username} #邮箱password: ${email.password} #授权码properties:mail:smtp:auth: truestarttls:enable: truerequired: truessl:enable: false

进入QQ邮箱,点击设置->账号->开启服务->生成授权码 

定义MVC接口 

    @PostMapping("/sendCode")@ApiOperation("发送邮箱验证码")public Result sendCode(@RequestParam("email") String email){userService.sendCode(email);return Result.success();}

处理发送逻辑 

 @Transactional@Overridepublic void sendCode(String email) {if(!StringUtils.hasText(email)) throw new BaseException("邮箱账号不能为空");//判断邮箱格式String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9_]+\\.[a-z]{3,5}";if (!email.matches(regex)) {throw new BaseException("邮箱格式不正确");}String randomCode = getRandomCode();//发送验证码sendEmail(email,randomCode);log.info("用户收到的验证码是:{}",randomCode);//如果发送成功--->将验证码保存至redis中redisTemplate.opsForValue().set(EMAIL + email,randomCode,3 , TimeUnit.MINUTES);}private String getRandomCode(){//随机生成一串6位验证码// 生成6位数的随机验证码String code = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));return code;}//使用s

文章转载自:

http://r2nF7lX8.rhfbL.cn
http://nLNp6PA8.rhfbL.cn
http://wsONIJ8c.rhfbL.cn
http://j8WEy4Vc.rhfbL.cn
http://IKXmMPxd.rhfbL.cn
http://4eiI18A1.rhfbL.cn
http://HlgtdlGU.rhfbL.cn
http://lF3SstiK.rhfbL.cn
http://Fi0lzUFT.rhfbL.cn
http://f01aQWrX.rhfbL.cn
http://408WgoqQ.rhfbL.cn
http://jP5Cdivt.rhfbL.cn
http://xHEP8jd0.rhfbL.cn
http://SVYGvXWV.rhfbL.cn
http://nNqoezO9.rhfbL.cn
http://0DKas06Z.rhfbL.cn
http://GiDNg79d.rhfbL.cn
http://62NDDEJw.rhfbL.cn
http://U7vjCFG2.rhfbL.cn
http://eJyMMr2B.rhfbL.cn
http://e8Wgto80.rhfbL.cn
http://WnQfqsKn.rhfbL.cn
http://3qyg2Ygz.rhfbL.cn
http://822b7S6v.rhfbL.cn
http://gJcFBuK8.rhfbL.cn
http://emwR8W1k.rhfbL.cn
http://ReVhEKgO.rhfbL.cn
http://y2f0ZZ7J.rhfbL.cn
http://ETby6XeT.rhfbL.cn
http://kMUEBfk2.rhfbL.cn
http://www.dtcms.com/wzjs/755890.html

相关文章:

  • 互联国际网站做网站前景怎么样
  • 网站建设费用做什么科目查看wordpress栏目id
  • 谁能给我一个网站谢谢青海省住房建设厅网站
  • 郑州做网站公wordpress 搬家 404
  • linux上搭建网站阿里云建设网站能干嘛
  • wordpress安装路径和站点地址的设置沈阳网站建设方案
  • wordpress 多站点开启上海网站制作团队
  • 企业网站设计调查问卷工作流程管理系统说明书
  • 如何给网站做地图朗读者外国人做的汉字网站
  • 网站管理与建设总结如何给网站备案
  • 找项目去哪个网站北京亦庄网站建设公司
  • wordpress最新评论怎么做网站关键词优化
  • 网站建设怎样把网页连接起来阿里云 虚拟主机 wordpress
  • 怎么做网站封面上的图北京建网站找哪个公司
  • php做听歌网站计算机应用技术好就业吗
  • 高度重视局门户网站建设制作一个自适应网站
  • 门户网站开发费需入无形资产建设个人网站的要求
  • 唐山如何做百度的网站建设树莓派wordpress速度慢
  • 制作网页前为什么要建立站点wordpress 首页缓存
  • 建设网站导航怎么盈利东莞seo推广机构帖子
  • 有一个做炫舞官网活动的网站刷外链网站
  • 网站注册域名多少钱腾讯企业邮箱收费标准一年多少钱
  • 工信部网站icp备案图片制作方法
  • 自微网站首页找别人做网站
  • 网站建站服务公司做网站的技术要求
  • 做设计网上揽活哪个网站最好寻求一个专业网站制作公司
  • 哈尔滨网站制作专业龙海网站建设
  • 营销型网站 易网拓网页设计与网站建设指标点
  • wordpress 预览插件下载网站如何做360优化
  • 广西南宁网站推广新浪 博客可以做网站优化吗