[EDIT]パスワード再設定までの遷移のバグ修正
This commit is contained in:
@@ -24,19 +24,38 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
.orElse(null);
|
||||
|
||||
if (userEntity == null) {
|
||||
System.out.println("ユーザーなし");
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("DB質問ID="
|
||||
+ userEntity.getQuestionEntity().getSecretQuestionId());
|
||||
|
||||
System.out.println("入力質問ID="
|
||||
+ authenticationForm.getSecretQuestionId());
|
||||
|
||||
if (!userEntity.getQuestionEntity().getSecretQuestionId()
|
||||
.equals(authenticationForm.getSecretQuestionId())) {
|
||||
|
||||
System.out.println("質問ID不一致");
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("DB回答=["
|
||||
+ userEntity.getSecretQuestionAnswer() + "]");
|
||||
|
||||
System.out.println("入力回答=["
|
||||
+ authenticationForm.getSecretAnswer() + "]");
|
||||
|
||||
if (!userEntity.getSecretQuestionAnswer()
|
||||
.equals(authenticationForm.getSecretAnswer())) {
|
||||
|
||||
System.out.println("回答不一致");
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("認証OK");
|
||||
|
||||
return new AuthenticationModel(userEntity.getUserId());
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||
import com.example.demo.app.domain.service.AuthenticationService;
|
||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -22,7 +22,6 @@ public class AuthenticationController {
|
||||
private final AuthenticationService authenticationService;
|
||||
private final QuestionRepository questionRepository;
|
||||
|
||||
@SessionCheck
|
||||
@GetMapping("/authentication")
|
||||
public String showAuthentication(Model model) {
|
||||
|
||||
@@ -32,7 +31,6 @@ public class AuthenticationController {
|
||||
return "authentication";
|
||||
}
|
||||
|
||||
@SessionCheck
|
||||
@PostMapping("/authentication")
|
||||
public String authenticate(
|
||||
AuthenticationForm authenticationForm,
|
||||
@@ -53,6 +51,10 @@ public class AuthenticationController {
|
||||
"passwordResetUserId",
|
||||
authenticationModel.getUserId());
|
||||
|
||||
model.addAttribute(
|
||||
"passwordResetForm",
|
||||
new PasswordResetForm());
|
||||
|
||||
return "password_reset";
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class AuthenticationForm {
|
||||
private String mailAddress;
|
||||
private Integer secretQuestionId;
|
||||
private Long secretQuestionId;
|
||||
private String secretAnswer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user