Giter Club home page Giter Club logo

minasmsverification's Introduction

基于阿里云的 微信小程序 短信验证 功能模块

SMS verification module based on Alibaba Cloud

  • Front End: WeChat mini program
  • Back End: Express + Alibaba Cloud

动图效果展示 / GIF Demonstration

动图效果展示

功能

小程序端:

  • 请求获取短信验证码
  • 两次请求之间间隔至少一分钟
  • 填写必填内容后,才能提交表单
  • 手机号合法性检验

后台:

  • 接前台请求后,通过阿里云发送短信
  • 生成随机数字验证码(默认6位)
  • 收到提交的表单后,对验证码字段进行判断
    • 验证码是否过期
    • 验证码是否正确
  • 通过验证后,方能进行下一步操作
    • 如保存表单信息至数据库等
  • 结果反馈

说明

  • 使用阿里云短信服务,需注册阿里云,创建AccessKeyId 与 AccessKeySecret,申请短信签名短信模板 ,即可使用
  • 将这些信息填入config.default.js中,并改名为config.js
  • 手机号合法性验证部分,为了让代码长期可用,没有针对现行号段进行详细检测,而是只进行了简略的格式检测
  • 有一个坑注意下:传入的验证码必须是JSON串格式,否则当字符串开头是0时,0会被忽略掉,得到小于6位的验证码
  • 如有帮助,请Star

minasmsverification's People

Contributors

beijiyang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.