diff --git a/app/controllers/error/AppError.scala b/app/controllers/error/AppError.scala index c217de9b7..2ff123d3f 100644 --- a/app/controllers/error/AppError.scala +++ b/app/controllers/error/AppError.scala @@ -193,7 +193,7 @@ object AppError { override val `type`: String = "SC-0018" override val title: String = s"Unable to activate company, code expired" override val details: String = - s"Impossible de créer le compte car le code a expiré. Merci de contacter le support." + s"Impossible de créer le compte car ce code d'activation a expiré. Si vous avez un courrier de SignalConso avec un code d'activation plus récent, essayez-le. Sinon, merci de contacter le support." override val titleForLogs: String = "company_activation_code_expired" } diff --git a/app/orchestrators/CompanyAccessOrchestrator.scala b/app/orchestrators/CompanyAccessOrchestrator.scala index 83b3aa45d..a0f93fe7b 100644 --- a/app/orchestrators/CompanyAccessOrchestrator.scala +++ b/app/orchestrators/CompanyAccessOrchestrator.scala @@ -57,13 +57,13 @@ class CompanyAccessOrchestrator( _ = logger.debug("Company found") token <- accessTokenRepository - .fetchActivationToken(company.id) + .findActivationToken(company.id, activationLinkRequest.token) .flatMap(_.liftTo[Future] { - logger.warn(s"No activation token found for siret $siret") + logger.warn(s"Activation token not found for siret $siret, given code is not valid") CompanyActivationSiretOrCodeInvalid(siret) }) _ = logger.debug("Token found") - _ <- validateToken(token, activationLinkRequest, siret) + _ <- validateToken(token, siret) _ = logger.debug("Token validated") _ <- accessesOrchestrator.addUserOrInvite(company, activationLinkRequest.email, AccessLevel.ADMIN, None) } yield () @@ -87,15 +87,11 @@ class CompanyAccessOrchestrator( else Future.successful(()) } yield result - def validateToken( + private def validateToken( accessToken: AccessToken, - activationLinkRequest: ActivationLinkRequest, siret: SIRET ): Future[Unit] = - if (activationLinkRequest.token != accessToken.token) { - logger.warn(s"Unable to activate company $siret, code is not valid.") - Future.failed(CompanyActivationSiretOrCodeInvalid(siret)) - } else if (!accessToken.valid) { + if (!accessToken.valid) { logger.warn(s"Unable to activate company $siret, code has already been used.") Future.failed(ActivationCodeAlreadyUsed()) } else if (accessToken.expirationDate.exists(expiration => now isAfter expiration)) { diff --git a/app/repositories/accesstoken/AccessTokenRepository.scala b/app/repositories/accesstoken/AccessTokenRepository.scala index 0461c9a67..f1c0a7f57 100644 --- a/app/repositories/accesstoken/AccessTokenRepository.scala +++ b/app/repositories/accesstoken/AccessTokenRepository.scala @@ -62,13 +62,14 @@ class AccessTokenRepository( .headOption ) - override def fetchActivationToken(companyId: UUID): Future[Option[AccessToken]] = + override def findActivationToken(companyId: UUID, token: String): Future[Option[AccessToken]] = db.run( table - .sortBy(_.creationDate.desc) .filter(_.companyId === companyId) + .filter(_.token === token) .filter(_.kind === (CompanyInit: TokenKind)) .filter(_.level === AccessLevel.ADMIN) + .sortBy(_.creationDate.desc) .result .headOption ) diff --git a/app/repositories/accesstoken/AccessTokenRepositoryInterface.scala b/app/repositories/accesstoken/AccessTokenRepositoryInterface.scala index 19d1d26fc..07a13008b 100644 --- a/app/repositories/accesstoken/AccessTokenRepositoryInterface.scala +++ b/app/repositories/accesstoken/AccessTokenRepositoryInterface.scala @@ -18,7 +18,7 @@ trait AccessTokenRepositoryInterface extends CRUDRepositoryInterface[AccessToken def fetchValidActivationToken(companyId: UUID): Future[Option[AccessToken]] - def fetchActivationToken(companyId: UUID): Future[Option[AccessToken]] + def findActivationToken(companyId: UUID, token: String): Future[Option[AccessToken]] def getToken(company: Company, id: UUID): Future[Option[AccessToken]] diff --git a/conf/messages.en b/conf/messages.en new file mode 100644 index 000000000..7576687f0 --- /dev/null +++ b/conf/messages.en @@ -0,0 +1,152 @@ +ConsumerValidateEmail.subject=Please validate this email address +ConsumerValidateEmail.title=Email address validation +ConsumerValidateEmail.hello=Hello, +ConsumerValidateEmail.activationCode=Your SignalConso activation code is: +ConsumerValidateEmail.team=The SignalConso Team +ConsumerValidateEmail.emailInfo=This email has been sent to you when submitting a report with this email address on the website {0} +ConsumerValidateEmail.notRequested=If you did not make this request, please disregard this email. + +ConsumerReportTransmittedEmail.subject=The company has acknowledged your report +ConsumerReportTransmittedEmail.title=The company has acknowledged your report +ConsumerReportTransmittedEmail.greeting=Hello {0} {1}, +ConsumerReportTransmittedEmail.reportDate=You submitted a report on {0} regarding a company: +ConsumerReportTransmittedEmail.siret=SIRET: {0} +ConsumerReportTransmittedEmail.companyAcknowledgement=The company has acknowledged your report today. +ConsumerReportTransmittedEmail.solutionEmail=If they offer a solution or fix the issue, you will receive an email. +ConsumerReportTransmittedEmail.fraudReport=For your information, the investigators from the fraud repression department have also received your report. +ConsumerReportTransmittedEmail.goodbye=See you soon on SignalConso! +ConsumerReportTransmittedEmail.team=The SignalConso Team +ConsumerReportTransmittedEmail.understandingSignalConso=Understanding SignalConso + +ConsumerReportAckProEmail.subject=The company has responded to your report, give us your opinion on their response +ConsumerReportAckProEmail.title=The company has responded to your report, give us your opinion on their response +ConsumerReportAckProEmail.greeting=Hello {0} {1}, +ConsumerReportAckProEmail.reportDescription=You submitted a report on {0} regarding a company: +ConsumerReportAckProEmail.companySiret=SIRET: {0} +ConsumerReportAckProEmail.responseHeader=The company has responded to your report. +ConsumerReportAckProEmail.responseContent=Here is their response: +ConsumerReportAckProEmail.satisfactionQuestion=Are you satisfied with this response? +ConsumerReportAckProEmail.clickYourChoice=Click on your choice: +ConsumerReportAckProEmail.situationImprovement=Please note that regardless of the company's response, the investigators from the fraud repression department may decide to conduct an inspection based on the information you provided. +ConsumerReportAckProEmail.waitingForImprovement=Do you want to wait and see if the situation improves? +ConsumerReportAckProEmail.newReportLink=Feel free to submit a new report if you find that the issue has not been resolved. This way, the fraud repression department will have better awareness of the situation. +ConsumerReportAckProEmail.satisfactionRequest=If SignalConso meets your satisfaction, please consider supporting us by posting on Twitter and Facebook. +ConsumerReportAckProEmail.serviceImprovement=Feel free to share your feedback about your SignalConso experience and let us know about your satisfaction, any issues you encountered, or your suggestions for improvement on Services publics +, the government platform dedicated to improving public services. +ConsumerReportAckProEmail.contributionThanks=Your contribution helps other consumers and is essential for our continued growth! +ConsumerReportAckProEmail.spreadTheWord=Don't hesitate to spread the word about SignalConso and encourage your acquaintances to do the same! Thank you! +ConsumerReportAckProEmail.teamSignature=The SignalConso Team +ConsumerReportAckProEmail.signalConsoExplanationHeader=Understanding SignalConso + +ReportClosedByNoReadingEmail.subject=The company chose not to review your report +ReportClosedByNoReadingEmail.entrepriseNoConsultation=The company chose not to review your report +ReportClosedByNoReadingEmail.bonjourMessage=Hello {0} {1}, +ReportClosedByNoReadingEmail.signalementMessage=You submitted a report on {0} regarding a company: +ReportClosedByNoReadingEmail.siretLabel=SIRET: {0} +ReportClosedByNoReadingEmail.malgreRelancesMessage=Despite our follow-ups, the company has chosen not to read your report. +ReportClosedByNoReadingEmail.enqueteurReceivedMessage=However, the investigators from the fraud repression department have received your report. +ReportClosedByNoReadingEmail.enqueteurDecideMessage=They may decide to inspect or monitor the company you reported based on the information you provided. +ReportClosedByNoReadingEmail.nouveauSignalementMessage=If you revisit this company and find that the issue has not been resolved, please submit a new report. Knowing that the situation persists is important information for the investigators. +ReportClosedByNoReadingEmail.contractualDisputeMessage=Alternatively, you can continue your efforts to find a solution or seek compensation. +ReportClosedByNoReadingEmail.continuerDemarches=Continue my efforts +ReportClosedByNoReadingEmail.reparationLitigeMessage=If you have already obtained a resolution regarding your dispute, you can disregard this message. +ReportClosedByNoReadingEmail.aBientotMessage=See you soon on SignalConso! +ReportClosedByNoReadingEmail.equipeSignalConso=The SignalConso Team +ReportClosedByNoReadingEmail.comprendreSignalConso=Understanding SignalConso + +ReportNotAnswered.subject=The company did not respond to the report +ReportNotAnswered.title=The company did not respond to the report +ReportNotAnswered.greeting=Hello {0} {1}, +ReportNotAnswered.reportDate=You submitted a report on {0} regarding a company: +ReportNotAnswered.companySiret=SIRET: {0} +ReportNotAnswered.noResponse=The company chose not to respond to your report. +ReportNotAnswered.enforcementConfirmation=However, the investigators from the fraud repression department have received your report. They may decide to inspect or monitor the company you reported based on the information you provided. +ReportNotAnswered.enforcementAdvice=If you revisit this company and find that the issue has not been resolved, please submit a new report. Knowing that the situation persists is important information for the investigators. +ReportNotAnswered.disputeAdvice=Alternatively, you can continue your efforts to find a solution or seek compensation. +ReportNotAnswered.continueAction=Continue my efforts +ReportNotAnswered.ignoreMessage=If you have already obtained a resolution regarding your dispute, you can disregard this message. +ReportNotAnswered.goodbye=See you soon on SignalConso! +ReportNotAnswered.signalConsoTeam=The SignalConso Team +ReportNotAnswered.understandSignalConso=Understanding SignalConso + +ReportAckEmail.subject=Your report +ReportAckEmail.hello=Hello {0} {1}, +ReportAckEmail.reportSubmitted=Your report has been successfully registered in SignalConso. +ReportAckEmail.employeeOfReportedCompany=You indicated that you are an employee of the company you reported. +ReportAckEmail.reportNotSentToCompany=To ensure the security of your employment, your report will not be sent to the company. +ReportAckEmail.fraudInvestigatorsInformed=However, the investigators from the fraud repression department will be informed of your report. +ReportAckEmail.foreignCompanyReported=You indicated that the company is a foreign company ({0}). +ReportAckEmail.reportNotTransmittedToCompany=As stated on our website, your report will not be transmitted to this company. +ReportAckEmail.submitToEuropeanConsumersCenter=We invite you to submit your report directly to the European Consumer Centre. They will provide assistance in resolving your issue. {0} +ReportAckEmail.submitToAndorraCommerceAndConsumption=We invite you to submit your report directly to the Andorra Commerce and Consumption Service: {0} +ReportAckEmail.fraudInvestigatorsTransferReport=However, the fraud investigators will transfer the report to the competent authorities of that country. +ReportAckEmail.submitToEconsumerGov=We invite you to submit your report to econsumer.gov to assist international authorities in combating fraud. {0} +ReportAckEmail.questionSubmitted=Your question has been successfully registered in SignalConso. +ReportAckEmail.respondentWillContactIfNeeded=A respondent will reach out to you if additional information is needed. You will receive a definitive response or be directed to the appropriate service as soon as possible. +ReportAckEmail.reportNotTransmittedToCompanyExceptFrench=As stated on our website, your report will not be transmitted to the company unless it is French and identifiable by the SignalConso team. +ReportAckEmail.fraudInvestigatorsInformedAndMayContact=In any case, the fraud investigators will be informed and may contact you for additional information. +ReportAckEmail.individualProblemReported=You reported an individual problem (dispute) +ReportAckEmail.companyNameExist=with company {0} +ReportAckEmail.websiteExist=with website {0} +ReportAckEmail.onSignalConso= on SignalConso. +ReportAckEmail.individualActionsRecommended=To increase your chances of finding a solution or obtaining compensation, we recommend that you initiate individual actions in parallel. +ReportAckEmail.pdfAttachmentUseful=Attached you will find your report in PDF format, which may be useful to you. +ReportAckEmail.startIndividualActions=Start my efforts +ReportAckEmail.whatWillHappen=What will happen? +ReportAckEmail.companyInformedToCorrectIssue=The company will be informed of your report so that they can correct the issue. +ReportAckEmail.emailNotificationUponCompanyReadingReport=You will receive an email as soon as the company reads the report. +ReportAckEmail.companiesHaveTwoMonthsToRegisterAndViewReport=Companies have a two-month period to create their account and review your report. +ReportAckEmail.reportSentToFraudInvestigators=If, despite our follow-ups, the company chooses not to review your report, you will be notified of their refusal. +ReportAckEmail.readOrNot=Whether the company reads your report or not, the fraud investigators will also be informed of your report. +ReportAckEmail.knowYourRightsForAirCompensation=If you want to know your rights regarding compensation for cancellations, delays, denied boarding, or downgrading, visit: Direction générale de l'Aviation civile +ReportAckEmail.currentProductRecallCampaigns=Current product recall campaigns for food items: +ReportAckEmail.doNotConsumeProductsAndTakePhotos=Individuals in possession of these products are asked not to consume them and to dispose of them immediately. +ReportAckEmail.takePhotosBeforeDisposal=(take photos of the packaging containing product details beforehand: expiration date, lot number, barcode, etc.). +ReportAckEmail.seekMedicalAdviceIfSymptoms=Individuals who have consumed these products and experience symptoms are advised to consult their general practitioner or go to the emergency room. If there are no symptoms, there is no need to be concerned. +ReportAckEmail.goodbyeSignalConso=See you soon on SignalConso! +ReportAckEmail.signalConsoTeam=The SignalConso Team +ReportAckEmail.reportDetails=Report Details +ReportAckEmail.problem=Problem +ReportAckEmail.description=Description +ReportAckEmail.attachments=Attachments: +ReportAckEmail.company=Company +ReportAckEmail.websiteURL=Website: {0} +ReportAckEmail.vendorName=Vendor Name: {0} +ReportAckEmail.consumer=Consumer +ReportAckEmail.lastName=Last Name: {0} +ReportAckEmail.firstName=First Name: {0} +ReportAckEmail.email=Email: {0} +ReportAckEmail.contactAgreement=Contact Agreement: {0} +ReportAckEmail.yes=yes +ReportAckEmail.no=no +ReportAckEmail.understandSignalConso=Understanding SignalConso +ReportAckEmail.yourReport=Your report + +reportPDF.page.title=Report Details {0} +reportPDF.references.uniqueId=Unique Identifier: {0} +reportPDF.references.documentExtractedOn=This document was extracted on: {0} +reportPDF.report.typeHeader=Report Type +reportPDF.report.detailHeader=Report Details +reportPDF.report.influencerHeader=Identified Influencer +reportPDF.report.influencerName=Pseudonym: {0} +reportPDF.report.influencerPlatform=Platform: {0} +reportPDF.report.responseHeader=Professional's Response +reportPDF.report.responseAccepted=Report Acknowledged +reportPDF.report.responseRejected=Unfounded Report +reportPDF.report.responseNotConcerned=Establishment Not Affected by the Report +reportPDF.report.dgccrfDetailsHeader=Additional Information for DGCCRF +reportPDF.report.consumerResponseHeader=Consumer's Response +reportPDF.report.consumerResponseDetailHeader=Consumer's Evaluation of Professional's Response: +reportPDF.report.consumerResponsePositive=Positive +reportPDF.report.consumerResponseNegative=Negative +reportPDF.report.consumerResponseNeutral=Neutral +reportPDF.report.consumerResponseDetail=Evaluation Detail: +reportPDF.report.companyHeader=Company +reportPDF.report.vendorHeader=Vendor +reportPDF.report.consumerHeader=Consumer +reportPDF.report.consumerAnonymousNote=The consumer wishes to remain anonymous +reportPDF.report.consumerReferenceNumber=Reference Number: {0} +reportPDF.report.attachmentsHeader=Attachments +reportPDF.report.noAttachments=No attachments are associated with this report. +reportPDF.report.historyHeader=Report History +reportPDF.report.historyEntryCreation=Report Creation +reportPDF.report.companyHistoryHeader=Company History \ No newline at end of file