验证码失效 - 慧眼----shiro - kaptcha -springboot

特别奇怪的问题---  

public R regist(String username, int sex, String captcha, String phone, String email, String id_card, String passWord, String birthday, String qq) {
// 取消验证码
// String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
// if (!captcha.equalsIgnoreCase(kaptcha)) {
// return R.error("验证码不正确");
// }


public static void setSessionAttribute(Object key, Object value) {
System.out.println("sission --- "+key);
getSession().setAttribute(key, value);
}


public static String getKaptcha(String key) {
Object kaptcha = getSessionAttribute(key);
System.out.println("kaptcha====="+kaptcha);
if (kaptcha == null) {
throw new RRException("验证码已失效");
}
getSession().removeAttribute(key);
return kaptcha.toString();
}

<div class="group">
<label class="label">验证码<span style="color: red">*</span></label>
<div><input id="captcha" v-model="captcha" type="number" class="input"
style="width: 100%;float: left" placeholder="点击图片刷新验证码"/>
<!--&emsp;&emsp;<a href="javascript:;" onclick="refreshCode()" id="refreshCode">点击刷新</a>-->
<img id="img_pre" alt="如果看不清楚,请单击图片刷新!" class="pointer" src="captcha.jpg"
onclick="refreshCode()"
style="border-top-right-radius: 25px;border-bottom-right-radius:25px;height: 40px;width: 100px;position: absolute;right: 0px;">
</div>
<!--<label class="tishi">验证码为右边计算的结果数</label>-->
</div>



猜你喜欢

转载自www.cnblogs.com/wen-/p/13204915.html