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