首页>代码>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日

zzzyyy1 LV2
2024年10月4日
Iterman LV2
2024年9月30日
edpwyg LV14
2024年7月28日
ykllykll
2024年7月24日
暂无贡献等级
17380184110
2024年6月18日
暂无贡献等级
微信网友_6754091131867136
2023年11月27日
暂无贡献等级
chenlie LV2
2023年11月21日
漫步的海星 LV4
2023年9月26日
dapeng0011 LV15
2023年6月19日
annazhang LV29
2023年4月8日