diff --git a/app/frontend/src/javascript/components/proof-of-identity/proof-of-identity-files.tsx b/app/frontend/src/javascript/components/proof-of-identity/proof-of-identity-files.tsx index 1eac9b8a1..bd712a6a2 100644 --- a/app/frontend/src/javascript/components/proof-of-identity/proof-of-identity-files.tsx +++ b/app/frontend/src/javascript/components/proof-of-identity/proof-of-identity-files.tsx @@ -10,6 +10,9 @@ import { ProofOfIdentityType } from '../../models/proof-of-identity-type'; import { ProofOfIdentityFile } from '../../models/proof-of-identity-file'; import ProofOfIdentityTypeAPI from '../../api/proof-of-identity-type'; import ProofOfIdentityFileAPI from '../../api/proof-of-identity-file'; +import { IFablab } from '../../models/fablab'; + +declare let Fablab: IFablab; declare const Application: IApplication; @@ -29,6 +32,8 @@ interface FilesType { const ProofOfIdentityFiles: React.FC = ({ currentUser, onSuccess, onError }) => { const { t } = useTranslation('admin'); + const maxProofOfIdentityFileSizeMb = (Fablab.maxProofOfIdentityFileSize / 1024 / 1024).toFixed(); + // list of proof of identity type const [proofOfIdentityTypes, setProofOfIdentityTypes] = useState>([]); const [proofOfIdentityFiles, setProofOfIdentityFiles] = useState>([]); @@ -64,8 +69,7 @@ const ProofOfIdentityFiles: React.FC = ({ currentUser return (event) => { const fileSize = event.target.files[0].size; let _errors = errors; - // 5m max - if (fileSize > 5242880) { + if (fileSize > Fablab.maxProofOfIdentityFileSize) { _errors = errors.concat(poitId); setErrors(_errors); } else { @@ -115,7 +119,7 @@ const ProofOfIdentityFiles: React.FC = ({ currentUser

{t('app.admin.members_edit.proof_of_identity_files')}

{t('app.admin.members_edit.my_documents_info')}

- +
{proofOfIdentityTypes.map((poit: ProofOfIdentityType) => { @@ -146,7 +150,7 @@ const ProofOfIdentityFiles: React.FC = ({ currentUser required />
- {errors.includes(poit.id) && {t('app.admin.members_edit.proof_of_identity_file_size_error')}} + {errors.includes(poit.id) && {t('app.admin.members_edit.proof_of_identity_file_size_error', { SIZE: maxProofOfIdentityFileSizeMb })}} ); })} diff --git a/app/frontend/src/javascript/models/fablab.ts b/app/frontend/src/javascript/models/fablab.ts index b9b507895..1c74d1b16 100644 --- a/app/frontend/src/javascript/models/fablab.ts +++ b/app/frontend/src/javascript/models/fablab.ts @@ -17,6 +17,7 @@ export interface IFablab { weekStartingDay: string, d3DateFormat: string, uibDateFormat: string, + maxProofOfIdentityFileSize: number, sessionTours: Array, translations: { app: { diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb index 84245c6fb..d9554eef0 100644 --- a/app/views/application/index.html.erb +++ b/app/views/application/index.html.erb @@ -63,6 +63,7 @@ Fablab.weekStartingDay = <%= Date.parse(Rails.application.secrets.week_starting_day).strftime('%w') %>; Fablab.d3DateFormat = "<%= Rails.application.secrets.d3_date_format %>"; Fablab.uibDateFormat = "<%= Rails.application.secrets.uib_date_format %>"; + Fablab.maxProofOfIdentityFileSize = <%= Rails.application.secrets.max_proof_of_identity_file_size&.to_i || 5.megabytes.to_i %>; // feature tour (used when feature_tour_display = session) Fablab.sessionTours = []; diff --git a/config/locales/app.admin.de.yml b/config/locales/app.admin.de.yml index 7b8bf5ccb..62f1bc00d 100644 --- a/config/locales/app.admin.de.yml +++ b/config/locales/app.admin.de.yml @@ -959,8 +959,8 @@ de: cannot_extend_own_subscription: "Sie können Ihr eigenes Abonnement nicht erweitern. Bitte fragen Sie einen anderen Manager oder einen Administrator." my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save" diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 830da1317..8a465d2fc 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -994,8 +994,8 @@ en: update_success: "Member's profile successfully updated" my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index 846b9af77..d98fd22eb 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -959,8 +959,8 @@ es: cannot_extend_own_subscription: "You cannot extend your own subscription. Please ask another manager or an administrator to extend your subscription." my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index a73ae7f0a..7076d7544 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -959,8 +959,8 @@ fr: cannot_extend_own_subscription: "Vous ne pouvez pas prolonger votre propre abonnement. Veuillez demander à un autre gestionnaire ou à un administrateur de prolonger votre abonnement." my_documents: "Mes documents" my_documents_info: "Suite à la déclaration de votre profil, vous devez déclarer des justificatifs. Une fois déposé, ces documents vont être vérifiés par l'administrateur." - proof_of_identity_file_size_error: "La limite de poids est 5 Mo max" - my_documents_alert: "Attention !
Vous pouvez déposer vos documents en pdf ou en image(jpg) sous une limite de poids de 5 Mo max" + proof_of_identity_file_size_error: "La limite de poids est {SIZE} Mo max" + my_documents_alert: "Attention !
Vous pouvez déposer vos documents en pdf ou en image(jpg) sous une limite de poids de {SIZE} Mo max" proof_of_identity_files: "Justificatifs" find_below_the_proof_of_identity_files: "Retrouvez ci-dessous, les justificatifs déposés par le membre." save: "Enregistrer" diff --git a/config/locales/app.admin.no.yml b/config/locales/app.admin.no.yml index b30054e4c..4d67616cf 100644 --- a/config/locales/app.admin.no.yml +++ b/config/locales/app.admin.no.yml @@ -959,8 +959,8 @@ cannot_extend_own_subscription: "Du kan ikke utvide ditt eget medlemskap. Be en annen leder eller en administrator om å utvide abonnementet." my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save" diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index d609af99f..52667cc93 100755 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -959,8 +959,8 @@ pt: cannot_extend_own_subscription: "Você não pode estender sua própria assinatura. Por favor, peça a outro gerente ou administrador para estender sua assinatura." my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save" diff --git a/config/locales/app.admin.zu.yml b/config/locales/app.admin.zu.yml index 0c16165e0..d8df46435 100644 --- a/config/locales/app.admin.zu.yml +++ b/config/locales/app.admin.zu.yml @@ -959,8 +959,8 @@ zu: cannot_extend_own_subscription: "crwdns20346:0crwdne20346:0" my_documents: "My documents" my_documents_info: "Following the declaration of your profile, you must declare the proof of identity documents. Once submitted, these documents will be verified by the administrator." - proof_of_identity_file_size_error: "The weight limit is 5 MB max" - my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of 5 Mb max" + proof_of_identity_file_size_error: "The weight limit is {SIZE} MB max" + my_documents_alert: "Attention!
You can submit your documents in pdf or in image (jpg) under a weight limit of {SIZE} Mb max" proof_of_identity_files: "Proof of identity" find_below_the_proof_of_identity_files: "You will find below the proof of identity documents submitted by the member." save: "Save"