永发信息网

如何使用Shiro实现用户注册成功后自动登录

答案:1  悬赏:0  手机版
解决时间 2021-11-29 04:32
  • 提问者网友:精神病院里
  • 2021-11-28 15:16
如何使用Shiro实现用户注册成功后自动登录
最佳答案
  • 五星知识达人网友:神的生死簿
  • 2021-11-28 16:55
之前用户注册后是先跳到登录页面:@RequestMapping(method = RequestMethod.POST) public String register(@Valid User user, RedirectAttributes redirectAttributes) { accountService.registerUser(user); redirectAttributes.addFlashAttribute("username", user.getLoginName()); return "redirect:/login"; } 现在要求用户注册成功后自动登录,改写如下:org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - user01, rememberMe=false] did not match the expected credentials. 问题补充:问题解决了,改写成token.setPassword(user.getPlainPassword().toCharArray()); 就可以了。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯