I want to validate the password and saved it to DB and then return the "saved" message below the password box image1 If the password doesn't meet the requirements then it should show "not valid" message as in the image2.
I am using spring boot. Controller code:
@GetMapping("/responseui")
public static String responseUi()
{
return "response.html";
}
@ResponseBody
@PostMapping("/testAuth")
public String checkPass(@RequestParam("username")String username,@RequestParam("password")String password)
{
String service = passService.saveService(username, password);
return service;
}
ServiceImpl:
public String saveService(String username, String password) {
Pattern p = Pattern.compile(regex);
if (password != null) {
Matcher m = p.matcher(password);
if (m.matches()) {
authentity.setUserName(username);
authentity.setPassword(password);
passRepo.save(authentity);
return "saved";
}
}
// PassController.responseUi();
return "http://localhost:8080/responseui";
}
Via Active questions tagged javascript - Stack Overflow https://ift.tt/6HiEc4R
Comments
Post a Comment