@ -10,11 +10,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam ;
import org.springframework.web.bind.annotation.RequestParam ;
import org.springframework.web.bind.annotation.RestController ;
import org.springframework.web.bind.annotation.RestController ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.waterproofingdata.wpdauth.dto.ForgotPasswordQuestionsResponseDTO ;
import org.waterproofingdata.wpdauth.dto.ForgotPasswordQuestionsUsersAnswersRequestDTO ;
import org.waterproofingdata.wpdauth.model.ForgotPasswordQuestionsUsersAnswers ;
import org.waterproofingdata.wpdauth.dto.ForgotPasswords QuestionsResponseDTO ;
import org.waterproofingdata.wpdauth.dto.ForgotPasswords QuestionsUsersAnswersRequestDTO ;
import org.waterproofingdata.wpdauth.model.ForgotPasswords QuestionsUsersAnswers ;
import org.waterproofingdata.wpdauth.dto.CustomMapper ;
import org.waterproofingdata.wpdauth.dto.CustomMapper ;
import org.waterproofingdata.wpdauth.service.ForgotPasswordService ;
import org.waterproofingdata.wpdauth.service.ForgotPasswords Service ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
import io.swagger.annotations.ApiOperation ;
@ -26,71 +26,71 @@ import io.swagger.annotations.Authorization;
@RestController
@RestController
@RequestMapping ( "/forgotpassword" )
@RequestMapping ( "/forgotpassword" )
@Api ( tags = "forgotpassword" )
@Api ( tags = "forgotpassword" )
public class ForgotPasswordController {
public class ForgotPasswords Controller {
@Autowired
@Autowired
private ForgotPasswordService forgotPasswordService ;
private ForgotPasswords Service forgotPasswords Service ;
@PostMapping ( "/sendkeybyemail" )
@PostMapping ( "/sendkeybyemail" )
@ApiOperation ( value = "${ForgotPasswordController.sendkeybyemail}" )
@ApiOperation ( value = "${ForgotPasswords Controller.sendkeybyemail}" )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 422 , message = "Invalid email supplied" ) } )
@ApiResponse ( code = 422 , message = "Invalid email supplied" ) } )
public void sendkeybyemail ( @ApiParam ( "Email" ) @RequestParam String email ) {
public void sendkeybyemail ( @ApiParam ( "Email" ) @RequestParam String email ) {
forgotPasswordService . sendKeyByEmail ( email ) ;
forgotPasswords Service . sendKeyByEmail ( email ) ;
}
}
@PostMapping ( "/loginbyemailandkey" )
@PostMapping ( "/loginbyemailandkey" )
@ApiOperation ( value = "${ForgotPasswordController.loginbyemailandkey}" )
@ApiOperation ( value = "${ForgotPasswords Controller.loginbyemailandkey}" )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 422 , message = "Invalid username/password supplied" ) } )
@ApiResponse ( code = 422 , message = "Invalid username/password supplied" ) } )
public String loginbyemailandkey ( / /
public String loginbyemailandkey ( / /
@ApiParam ( "Email" ) @RequestParam String email , / /
@ApiParam ( "Email" ) @RequestParam String email , / /
@ApiParam ( "Key" ) @RequestParam String key ) {
@ApiParam ( "Key" ) @RequestParam String key ) {
return forgotPasswordService . loginByEmailAndKey ( email , key ) ;
return forgotPasswords Service . loginByEmailAndKey ( email , key ) ;
}
}
@PostMapping ( "/passwordupdatebyemail" )
@PostMapping ( "/passwordupdatebyemail" )
@PreAuthorize ( "hasRole('ROLE_ADMIN') or hasRole('ROLE_INSTITUTION') or hasRole('ROLE_CLIENT')" )
@PreAuthorize ( "hasRole('ROLE_ADMIN') or hasRole('ROLE_INSTITUTION') or hasRole('ROLE_CLIENT')" )
@ApiOperation ( value = "${ForgotPasswordController.passwordupdatebyemail}" , authorizations = { @Authorization ( value = "apiKey" ) } )
@ApiOperation ( value = "${ForgotPasswords Controller.passwordupdatebyemail}" , authorizations = { @Authorization ( value = "apiKey" ) } )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 403 , message = "Access denied" ) , / /
@ApiResponse ( code = 403 , message = "Access denied" ) , / /
@ApiResponse ( code = 404 , message = "The user doesn't exist" ) , / /
@ApiResponse ( code = 404 , message = "The user doesn't exist" ) , / /
@ApiResponse ( code = 500 , message = "Expired or invalid JWT token" ) } )
@ApiResponse ( code = 500 , message = "Expired or invalid JWT token" ) } )
public void passwordupdatebyemail ( @ApiParam ( "Email" ) @RequestParam String email , @ApiParam ( "NewPassword" ) @RequestParam String newPassword ) {
public void passwordupdatebyemail ( @ApiParam ( "Email" ) @RequestParam String email , @ApiParam ( "NewPassword" ) @RequestParam String newPassword ) {
forgotPasswordService . passwordUpdateByEmail ( email , newPassword ) ;
forgotPasswords Service . passwordUpdateByEmail ( email , newPassword ) ;
}
}
@PostMapping ( "/findallforgotpasswordquestions" )
@PostMapping ( "/findallforgotpasswordquestions" )
@ApiOperation ( value = "${ForgotPasswordController.findallforgotpasswordquestions}" )
@ApiOperation ( value = "${ForgotPasswords Controller.findallforgotpasswordquestions}" )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) } )
@ApiResponse ( code = 400 , message = "Something went wrong" ) } )
public List < ForgotPasswordQuestionsResponseDTO > findallforgotpasswordquestions ( ) {
return CustomMapper . mapAll ( forgotPasswordService . findAllForgotPasswordQuestions ( ) , ForgotPasswordQuestionsResponseDTO . class ) ;
public List < ForgotPasswords QuestionsResponseDTO > findallforgotpasswordquestions ( ) {
return CustomMapper . mapAll ( forgotPasswords Service . findAllForgotPasswordQuestions ( ) , ForgotPasswords QuestionsResponseDTO . class ) ;
}
}
@PostMapping ( "/saveforgotpasswordquestionsusersanswers" )
@PostMapping ( "/saveforgotpasswordquestionsusersanswers" )
@PreAuthorize ( "hasRole('ROLE_ADMIN') or hasRole('ROLE_INSTITUTION') or hasRole('ROLE_CLIENT')" )
@PreAuthorize ( "hasRole('ROLE_ADMIN') or hasRole('ROLE_INSTITUTION') or hasRole('ROLE_CLIENT')" )
@ApiOperation ( value = "${ForgotPasswordController.saveforgotpasswordquestionsusersanswers}" , authorizations = { @Authorization ( value = "apiKey" ) } )
@ApiOperation ( value = "${ForgotPasswords Controller.saveforgotpasswordquestionsusersanswers}" , authorizations = { @Authorization ( value = "apiKey" ) } )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 403 , message = "Access denied" ) , / /
@ApiResponse ( code = 403 , message = "Access denied" ) , / /
@ApiResponse ( code = 404 , message = "The user or forgot password questions don't exist" ) , / /
@ApiResponse ( code = 404 , message = "The user or forgot password questions don't exist" ) , / /
@ApiResponse ( code = 500 , message = "Expired or invalid JWT token" ) } )
@ApiResponse ( code = 500 , message = "Expired or invalid JWT token" ) } )
public void saveforgotpasswordquestionsusersanswers ( @ApiParam ( "Forgot Password Questions Users Answers" ) @RequestBody ForgotPasswordQuestionsUsersAnswersRequestDTO answer ) {
forgotPasswordService . saveForgotPasswordQuestionsUsersAnswers ( CustomMapper . map ( answer , ForgotPasswordQuestionsUsersAnswers . class ) ) ;
public void saveforgotpasswordquestionsusersanswers ( @ApiParam ( "Forgot Password Questions Users Answers" ) @RequestBody ForgotPasswords QuestionsUsersAnswersRequestDTO answer ) {
forgotPasswords Service . saveForgotPasswordQuestionsUsersAnswers ( CustomMapper . map ( answer , ForgotPasswords QuestionsUsersAnswers . class ) ) ;
}
}
@PostMapping ( "/loginbyemailandanswers" )
@PostMapping ( "/loginbyemailandanswers" )
@ApiOperation ( value = "${ForgotPasswordController.loginbyemailandanswers}" )
@ApiOperation ( value = "${ForgotPasswords Controller.loginbyemailandanswers}" )
@ApiResponses ( value = { / /
@ApiResponses ( value = { / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 400 , message = "Something went wrong" ) , / /
@ApiResponse ( code = 404 , message = "The user or answer don't exist" ) , / /
@ApiResponse ( code = 404 , message = "The user or answer don't exist" ) , / /
@ApiResponse ( code = 422 , message = "Invalid answers supplied to login. Must have at least 2 correct ones." ) } )
@ApiResponse ( code = 422 , message = "Invalid answers supplied to login. Must have at least 2 correct ones." ) } )
public String loginbyemailandanswers ( / /
public String loginbyemailandanswers ( / /
@ApiParam ( "Email" ) @RequestParam String email , / /
@ApiParam ( "Email" ) @RequestParam String email , / /
@ApiParam ( "Answers" ) @RequestParam List < ForgotPasswordQuestionsUsersAnswersRequestDTO > answers ) {
return forgotPasswordService . loginByEmailAndAnswers ( email , CustomMapper . mapAll ( answers , ForgotPasswordQuestionsUsersAnswers . class ) ) ;
@ApiParam ( "Answers" ) @RequestParam List < ForgotPasswords QuestionsUsersAnswersRequestDTO > answers ) {
return forgotPasswords Service . loginByEmailAndAnswers ( email , CustomMapper . mapAll ( answers , ForgotPasswords QuestionsUsersAnswers . class ) ) ;
}
}
}
}