我正在使用登录的 spring Security,它工作正常。
我在用户实体的数据库中有字段
boolean confirmed
我要
If confirmed field is set to false , then comes the authentication error and tells user that email is registered but not confirmed and should allow the user to resend the activation link again
最佳答案
创建一个 ROLE_CONFIRMED 并将您的大部分页面设置为 access="ROLE_CONFIRMED"。
然后创建一个 AuthenticationSuccessHandler,如果用户没有 ROLE_CONFIRMED 重定向到告诉他们“电子邮件已注册但未确认并且应该允许用户再次重新发送激活链接”的页面。
当用户确认他们的电子邮件时,给他们 ROLE_CONFIRMED。
关于java - 如何在 Spring Security 3 的用户登录中添加一些自己的逻辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5386179/