Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEP : TRELLO-1890 Refine error feedback on register form #1416

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/error/AppError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
14 changes: 5 additions & 9 deletions app/orchestrators/CompanyAccessOrchestrator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand All @@ -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)) {
Expand Down
5 changes: 3 additions & 2 deletions app/repositories/accesstoken/AccessTokenRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down
152 changes: 152 additions & 0 deletions conf/messages.en
Original file line number Diff line number Diff line change
@@ -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 <b>{0}</b> regarding a company:
ConsumerReportTransmittedEmail.siret=SIRET: <b>{0}</b>
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: <b>{0}</b>
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 <a href="https://twitter.com/signalconso" target="_blank">Twitter</a> and <a href="https://www.facebook.com/SignalConso/" target="_blank">Facebook</a>.
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 <a href="https://www.plus.transformation.gouv.fr/experience/step_1?pk_campaign=DGCCRF">Services publics +</a>, 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 <b>{0}</b> regarding a company:
ReportClosedByNoReadingEmail.siretLabel=SIRET: <b>{0}</b>
ReportClosedByNoReadingEmail.malgreRelancesMessage=Despite our follow-ups, <b>the company has chosen not to read your report.</b>
ReportClosedByNoReadingEmail.enqueteurReceivedMessage=However, <b>the investigators from the fraud repression department have received your report.</b>
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 <b>{0}</b> regarding a company:
ReportNotAnswered.companySiret=SIRET: <b>{0}</b>
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. <a href="{0}">{0}</a>
ReportAckEmail.submitToAndorraCommerceAndConsumption=We invite you to submit your report directly to the Andorra Commerce and Consumption Service: <a href="{0}">{0}</a>
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. <a href="{0}">{0}</a>
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, <b>the fraud investigators will also be informed of your report.</b>
ReportAckEmail.knowYourRightsForAirCompensation=If you want to know your rights regarding compensation for cancellations, delays, denied boarding, or downgrading, visit: <a href="{0}">Direction générale de l'Aviation civile</a>
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