前端使用VUE+elementUI在表单中添加验证码的按钮和输入框,登录时先验证验证码,验证通过后才会验证登录密码。
//验证验证码的
const verificationCode =reactive({
answer: '', //答案
formula: '', //验证码的公式
})
//获取验证码
const getVerificationCode = () => {
axios.get("/api/auth/generateVerification").then(res => {
console.log(res.data);
if(res.data.code === 200){
verificationCode.formula = res.data.object;
}else
ElMessage.error(res.data.message);
})
}
getVerificationCode();//初始化获取验证码
后端springboot+redis
package com.example