首页>代码>springboot自定义注解实现重置密码验证功能>/field-match/src/main/java/com/memorynotfound/spring/security/web/PasswordResetController.java
package com.memorynotfound.spring.security.web; import com.memorynotfound.spring.security.web.dto.PasswordResetDto; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.validation.Valid; @Controller public class PasswordResetController { @ModelAttribute("passwordResetForm") public PasswordResetDto passwordReset() { return new PasswordResetDto(); } @GetMapping("reset-password") public String showPasswordReset(Model model) { return "reset-password"; } @GetMapping("reset-success") public String showPasswordSuccess(Model model) { return "reset-success"; } @PostMapping public String handlePasswordReset(@ModelAttribute("passwordResetForm") @Valid PasswordResetDto form, BindingResult result) { if (result.hasErrors()) { return "reset-password"; } return "redirect:/reset-success"; } }
最近下载更多
annazhang LV29
2023年4月8日
whfuai LV14
2022年9月17日
苏屿999 LV9
2021年10月21日
弹指又十年 LV8
2021年10月17日
Curryhuang LV3
2021年6月22日
最近浏览更多
微信网友_6754091131867136
2023年11月27日
暂无贡献等级
chenlie LV2
2023年11月21日
漫步的海星 LV4
2023年9月26日
dapeng0011 LV13
2023年6月19日
annazhang LV29
2023年4月8日
zxc131313 LV12
2023年2月2日
ROCK森 LV12
2022年11月7日
秋枫花落叶 LV2
2022年11月3日
wuying8208 LV15
2022年10月31日
whfuai LV14
2022年9月17日