1.新增驗證碼
application Controller新增captcha()
public static void captcha() {
Images.Captcha captcha = Images.captcha();
rages.Captcha captcha = Images.captcha();? Route
GET /captcha cha
驗證碼圖片已經實現了,現在需要做的是驗證輸入資訊與驗證碼一致
Images.Captcha captcha = Images.captcha(); String code = captcha.getText("#E4EAFD"); code, "10mn"); renderBinary(captcha);
} 修改show()方法public static void show(Long id) { omID = Codec.UUID();
render(post, randomID);
}
lab code">Please type the code below:
="submit" value="Submit your comment" />
2.驗證
vpostComment or is required") String author,
@Required(message="A message is required") String content,
@Required(message="Please type the code") String code,
String randomId) {
post. findById(postId);
validation.equals(code, Cache.get(randomId)).message("Invalid code. Please type it again");
has it again");
我show.html", post);
}
}
修改show.html頁
#{ifErrors}
c