@strapi/plugin-users-permissions 5.42.1 → 5.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,35 +12,72 @@
12
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "Adresa pro přesměrování",
13
13
  "EditForm.inputToggle.label.email-reset-password": "Stránka pro obnovení hesla",
14
14
  "EditForm.inputToggle.label.sign-up": "Povolit registrace",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "ex: https://yourfrontend.com/email-confirmation-redirection",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "ex: https://yourfrontend.com/reset-password",
17
+ "EditPage.form.roles": "Detaily role",
18
+ "Email.template.data.loaded": "E-mailové šablony byly načteny",
19
+ "Email.template.email_confirmation": "Potvrzení e-mailové adresy",
20
+ "Email.template.reset_password": "Obnovení hesla",
21
+ "Email.template.form.edit.label": "Upravit šablonu",
22
+ "Email.template.table.action.label": "akce",
23
+ "Email.template.table.icon.label": "ikona",
24
+ "Email.template.table.name.label": "název",
25
+ "Form.advancedSettings.data.loaded": "Data pokročilých nastavení byla načtena",
15
26
  "HeaderNav.link.advancedSettings": "Pokročilá nastavení",
16
27
  "HeaderNav.link.emailTemplates": "E-mailové šablony",
17
28
  "HeaderNav.link.providers": "Poskytovatelé",
18
- "Plugin.permissions.plugins.description": "Nastavit všechny akce pro zásuvný modul {name}.",
29
+ "Plugin.permissions.plugins.description": "Nastavit všechny akce pro plugin {name}.",
19
30
  "Plugins.header.description": "Pouze akce spojené s adresou jsou vypsány níže.",
20
31
  "Plugins.header.title": "Povolení",
21
- "Policies.header.hint": "Vyberte akce aplikace, nebo akce zásuvného modulu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
32
+ "Policies.header.hint": "Vyberte akce aplikace, nebo akce pluginu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
22
33
  "Policies.header.title": "Pokročilá nastavení",
23
34
  "PopUpForm.Email.email_templates.inputDescription": "Pokud si nejste jisti jak používat proměnné, {link}",
35
+ "PopUpForm.Email.link.documentation": "podívejte se do naší dokumentace.",
24
36
  "PopUpForm.Email.options.from.email.label": "Odesilatelův e-mail",
25
37
  "PopUpForm.Email.options.from.email.placeholder": "jannovak@gmail.com",
26
38
  "PopUpForm.Email.options.from.name.label": "Jméno odesilatele",
27
39
  "PopUpForm.Email.options.from.name.placeholder": "Jan Novák",
28
40
  "PopUpForm.Email.options.message.label": "Zpráva",
29
41
  "PopUpForm.Email.options.object.label": "Předmět",
42
+ "PopUpForm.Email.options.object.placeholder": "Potvrďte prosím svou e-mailovou adresu pro %APP_NAME%",
30
43
  "PopUpForm.Email.options.response_email.label": "Response e-mail",
31
44
  "PopUpForm.Email.options.response_email.placeholder": "jannovak@gmail.com",
32
- "PopUpForm.Providers.enabled.description": "If disabled, users won't be able to use this provider.",
45
+ "PopUpForm.Providers.enabled.description": "Pokud je zakázáno, uživatelé nebudou moci tohoto poskytovatele použít.",
33
46
  "PopUpForm.Providers.enabled.label": "Povolit",
34
47
  "PopUpForm.Providers.key.label": "Client ID",
35
48
  "PopUpForm.Providers.key.placeholder": "TEXT",
36
49
  "PopUpForm.Providers.redirectURL.front-end.label": "Adresa pro přesměrování na vaši front-end aplikaci",
50
+ "PopUpForm.Providers.redirectURL.label": "Adresa pro přesměrování, kterou je třeba přidat do konfigurace vaší aplikace {provider}",
37
51
  "PopUpForm.Providers.secret.label": "Client Secret",
38
52
  "PopUpForm.Providers.secret.placeholder": "TEXT",
39
53
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
40
54
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
41
55
  "PopUpForm.header.edit.email-templates": "Upravit e-mailové šablony",
56
+ "PopUpForm.header.edit.providers": "Upravit poskytovatele",
57
+ "Providers.data.loaded": "Poskytovatelé byli načteni",
58
+ "Providers.status": "Stav",
59
+ "Roles.empty": "Zatím nemáte žádné role.",
60
+ "Roles.empty.search": "Hledání neodpovídají žádné role.",
61
+ "Settings.roles.deleted": "Role smazána",
62
+ "Settings.roles.edited": "Role upravena",
63
+ "Settings.section-label": "Plugin Users & Permissions",
64
+ "components.Input.error.validation.email": "Toto není platný e-mail",
65
+ "components.Input.error.validation.json": "Toto neodpovídá formátu JSON",
66
+ "components.Input.error.validation.max": "Hodnota je příliš vysoká.",
67
+ "components.Input.error.validation.maxLength": "Hodnota je příliš dlouhá.",
68
+ "components.Input.error.validation.min": "Hodnota je příliš nízká.",
69
+ "components.Input.error.validation.minLength": "Hodnota je příliš krátká.",
70
+ "components.Input.error.validation.minSupMax": "Nemůže být vyšší",
71
+ "components.Input.error.validation.regex": "Hodnota neodpovídá regulárnímu výrazu.",
72
+ "components.Input.error.validation.required": "Tato hodnota je povinná.",
73
+ "components.Input.error.validation.unique": "Tato hodnota už je použita.",
42
74
  "notification.success.submit": "Nastavení bylo aktualizování",
43
- "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento zásuvný modul obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
75
+ "page.title": "Nastavení - Role",
76
+ "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento plugin obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
44
77
  "plugin.description.short": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT",
45
- "plugin.name": "Role a oprávnění"
78
+ "plugin.name": "Role a oprávnění",
79
+ "popUpWarning.button.cancel": "Zrušit",
80
+ "popUpWarning.button.confirm": "Potvrdit",
81
+ "popUpWarning.title": "Prosím potvrďte",
82
+ "popUpWarning.warning.cancel": "Opravdu chcete zrušit své úpravy?"
46
83
  }
@@ -5,11 +5,24 @@
5
5
  "EditForm.inputToggle.description.email": "Zorg ervoor dat de gebruiker niet meerdere accounts kan maken met hetzelfde e-mailadres maar met verschillende leveranciers.",
6
6
  "EditForm.inputToggle.description.email-confirmation": "Wanneer ingeschakeld (ON), ontvangen nieuw geregistreerde gebruikers een bevestigingsmail.",
7
7
  "EditForm.inputToggle.description.email-confirmation-redirection": "Na het bevestigen van je e-mail, kies naar waar je doorgestuurd zal worden.",
8
+ "EditForm.inputToggle.description.email-reset-password": "URL van de wachtwoord-herstelpagina van je applicatie",
8
9
  "EditForm.inputToggle.description.sign-up": "Wanneer uitgeschakeld (OFF), is registratie verboden. Niemand kan abonneren ongeacht de leverancier",
9
10
  "EditForm.inputToggle.label.email": "Één account per e-mailadres.",
10
11
  "EditForm.inputToggle.label.email-confirmation": "Schakel emailbevestiging in",
11
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "Doorstuur URL",
13
+ "EditForm.inputToggle.label.email-reset-password": "Wachtwoord-herstelpagina",
12
14
  "EditForm.inputToggle.label.sign-up": "Registratie inschakelen",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "bijv.: https://uwfrontend.nl/e-mailbevestiging",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "bijv.: https://uwfrontend.nl/wachtwoord-herstellen",
17
+ "EditPage.form.roles": "Roldetails",
18
+ "Email.template.data.loaded": "E-mailtemplates zijn geladen",
19
+ "Email.template.email_confirmation": "E-mailadresbevestiging",
20
+ "Email.template.form.edit.label": "Een template bewerken",
21
+ "Email.template.reset_password": "Wachtwoord herstellen",
22
+ "Email.template.table.action.label": "actie",
23
+ "Email.template.table.icon.label": "pictogram",
24
+ "Email.template.table.name.label": "naam",
25
+ "Form.advancedSettings.data.loaded": "Geavanceerde instellingen zijn geladen",
13
26
  "HeaderNav.link.advancedSettings": "Geavanceerde instellingen",
14
27
  "HeaderNav.link.emailTemplates": "E-mail sjabloon",
15
28
  "HeaderNav.link.providers": "Leveranciers",
@@ -19,12 +32,14 @@
19
32
  "Policies.header.hint": "Selecteer de actie van de applicatie of de acties van de extensie en klik op het tandwiel icoontje om de gekoppelde route weer te geven",
20
33
  "Policies.header.title": "Geavanceerde instellingen",
21
34
  "PopUpForm.Email.email_templates.inputDescription": "Als je niet zeker weet hoe je variabelen moet gebruiken, {link}",
35
+ "PopUpForm.Email.link.documentation": "bekijk onze documentatie.",
22
36
  "PopUpForm.Email.options.from.email.label": "Afzender e-mail",
23
37
  "PopUpForm.Email.options.from.email.placeholder": "kai@doe.com",
24
38
  "PopUpForm.Email.options.from.name.label": "Afzender naam",
25
39
  "PopUpForm.Email.options.from.name.placeholder": "Kai Doe",
26
40
  "PopUpForm.Email.options.message.label": "Bericht",
27
41
  "PopUpForm.Email.options.object.label": "Onderwerp",
42
+ "PopUpForm.Email.options.object.placeholder": "Bevestig je e-mailadres voor %APP_NAME%",
28
43
  "PopUpForm.Email.options.response_email.label": "Antwoord e-mail",
29
44
  "PopUpForm.Email.options.response_email.placeholder": "kai@doe.com",
30
45
  "PopUpForm.Providers.enabled.description": "Als deze uitgeschakeld is kunnen gebruikers geen gebruik maken van deze leverancier.",
@@ -32,13 +47,37 @@
32
47
  "PopUpForm.Providers.key.label": "Client ID",
33
48
  "PopUpForm.Providers.key.placeholder": "TEXT",
34
49
  "PopUpForm.Providers.redirectURL.front-end.label": "De doorstuur URL voor jouw front-end app",
50
+ "PopUpForm.Providers.redirectURL.label": "De redirect-URL om toe te voegen in je {provider}-applicatieconfiguratie",
35
51
  "PopUpForm.Providers.secret.label": "Client Secret",
36
52
  "PopUpForm.Providers.secret.placeholder": "TEXT",
37
53
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
38
54
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
39
55
  "PopUpForm.header.edit.email-templates": "E-mail sjablonen aanpassen",
56
+ "PopUpForm.header.edit.providers": "Provider bewerken",
57
+ "Providers.data.loaded": "Providers zijn geladen",
58
+ "Providers.status": "Status",
59
+ "Roles.empty": "Je hebt nog geen rollen.",
60
+ "Roles.empty.search": "Geen rollen gevonden.",
61
+ "Settings.roles.deleted": "Rol verwijderd",
62
+ "Settings.roles.edited": "Rol bewerkt",
63
+ "Settings.section-label": "Users & Permissions plugin",
64
+ "components.Input.error.validation.email": "Dit is geen geldig e-mailadres",
65
+ "components.Input.error.validation.json": "Dit komt niet overeen met het JSON-formaat",
66
+ "components.Input.error.validation.max": "De waarde is te hoog.",
67
+ "components.Input.error.validation.maxLength": "De waarde is te lang.",
68
+ "components.Input.error.validation.min": "De waarde is te laag.",
69
+ "components.Input.error.validation.minLength": "De waarde is te kort.",
70
+ "components.Input.error.validation.minSupMax": "Kan niet hoger zijn",
71
+ "components.Input.error.validation.regex": "De waarde komt niet overeen met de regex.",
72
+ "components.Input.error.validation.required": "Deze waarde is verplicht.",
73
+ "components.Input.error.validation.unique": "Deze waarde is al in gebruik.",
40
74
  "notification.success.submit": "Instellingen zijn geüpdatet",
75
+ "page.title": "Instellingen - Rollen",
41
76
  "plugin.description.long": "Beveilig je API met een volledig authenticatie proces op JWT. Deze extensie komt ook met een ACL strategie welke ervoor zorgt dat je de permissies tussen groepen van gebruikers kan beheren.",
42
77
  "plugin.description.short": "Beveilig je API met een volledig authenticatie proces op JWT",
43
- "plugin.name": "Rollen & Permissies"
78
+ "plugin.name": "Rollen & Permissies",
79
+ "popUpWarning.button.cancel": "Annuleren",
80
+ "popUpWarning.button.confirm": "Bevestigen",
81
+ "popUpWarning.title": "Bevestig a.u.b.",
82
+ "popUpWarning.warning.cancel": "Weet je zeker dat je je wijzigingen wilt annuleren?"
44
83
  }
@@ -14,37 +14,74 @@ var cs = {
14
14
  "EditForm.inputToggle.label.email-confirmation-redirection": "Adresa pro přesměrování",
15
15
  "EditForm.inputToggle.label.email-reset-password": "Stránka pro obnovení hesla",
16
16
  "EditForm.inputToggle.label.sign-up": "Povolit registrace",
17
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "ex: https://yourfrontend.com/email-confirmation-redirection",
18
+ "EditForm.inputToggle.placeholder.email-reset-password": "ex: https://yourfrontend.com/reset-password",
19
+ "EditPage.form.roles": "Detaily role",
20
+ "Email.template.data.loaded": "E-mailové šablony byly načteny",
21
+ "Email.template.email_confirmation": "Potvrzení e-mailové adresy",
22
+ "Email.template.reset_password": "Obnovení hesla",
23
+ "Email.template.form.edit.label": "Upravit šablonu",
24
+ "Email.template.table.action.label": "akce",
25
+ "Email.template.table.icon.label": "ikona",
26
+ "Email.template.table.name.label": "název",
27
+ "Form.advancedSettings.data.loaded": "Data pokročilých nastavení byla načtena",
17
28
  "HeaderNav.link.advancedSettings": "Pokročilá nastavení",
18
29
  "HeaderNav.link.emailTemplates": "E-mailové šablony",
19
30
  "HeaderNav.link.providers": "Poskytovatelé",
20
- "Plugin.permissions.plugins.description": "Nastavit všechny akce pro zásuvný modul {name}.",
31
+ "Plugin.permissions.plugins.description": "Nastavit všechny akce pro plugin {name}.",
21
32
  "Plugins.header.description": "Pouze akce spojené s adresou jsou vypsány níže.",
22
33
  "Plugins.header.title": "Povolení",
23
- "Policies.header.hint": "Vyberte akce aplikace, nebo akce zásuvného modulu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
34
+ "Policies.header.hint": "Vyberte akce aplikace, nebo akce pluginu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
24
35
  "Policies.header.title": "Pokročilá nastavení",
25
36
  "PopUpForm.Email.email_templates.inputDescription": "Pokud si nejste jisti jak používat proměnné, {link}",
37
+ "PopUpForm.Email.link.documentation": "podívejte se do naší dokumentace.",
26
38
  "PopUpForm.Email.options.from.email.label": "Odesilatelův e-mail",
27
39
  "PopUpForm.Email.options.from.email.placeholder": "jannovak@gmail.com",
28
40
  "PopUpForm.Email.options.from.name.label": "Jméno odesilatele",
29
41
  "PopUpForm.Email.options.from.name.placeholder": "Jan Novák",
30
42
  "PopUpForm.Email.options.message.label": "Zpráva",
31
43
  "PopUpForm.Email.options.object.label": "Předmět",
44
+ "PopUpForm.Email.options.object.placeholder": "Potvrďte prosím svou e-mailovou adresu pro %APP_NAME%",
32
45
  "PopUpForm.Email.options.response_email.label": "Response e-mail",
33
46
  "PopUpForm.Email.options.response_email.placeholder": "jannovak@gmail.com",
34
- "PopUpForm.Providers.enabled.description": "If disabled, users won't be able to use this provider.",
47
+ "PopUpForm.Providers.enabled.description": "Pokud je zakázáno, uživatelé nebudou moci tohoto poskytovatele použít.",
35
48
  "PopUpForm.Providers.enabled.label": "Povolit",
36
49
  "PopUpForm.Providers.key.label": "Client ID",
37
50
  "PopUpForm.Providers.key.placeholder": "TEXT",
38
51
  "PopUpForm.Providers.redirectURL.front-end.label": "Adresa pro přesměrování na vaši front-end aplikaci",
52
+ "PopUpForm.Providers.redirectURL.label": "Adresa pro přesměrování, kterou je třeba přidat do konfigurace vaší aplikace {provider}",
39
53
  "PopUpForm.Providers.secret.label": "Client Secret",
40
54
  "PopUpForm.Providers.secret.placeholder": "TEXT",
41
55
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
42
56
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
43
57
  "PopUpForm.header.edit.email-templates": "Upravit e-mailové šablony",
58
+ "PopUpForm.header.edit.providers": "Upravit poskytovatele",
59
+ "Providers.data.loaded": "Poskytovatelé byli načteni",
60
+ "Providers.status": "Stav",
61
+ "Roles.empty": "Zatím nemáte žádné role.",
62
+ "Roles.empty.search": "Hledání neodpovídají žádné role.",
63
+ "Settings.roles.deleted": "Role smazána",
64
+ "Settings.roles.edited": "Role upravena",
65
+ "Settings.section-label": "Plugin Users & Permissions",
66
+ "components.Input.error.validation.email": "Toto není platný e-mail",
67
+ "components.Input.error.validation.json": "Toto neodpovídá formátu JSON",
68
+ "components.Input.error.validation.max": "Hodnota je příliš vysoká.",
69
+ "components.Input.error.validation.maxLength": "Hodnota je příliš dlouhá.",
70
+ "components.Input.error.validation.min": "Hodnota je příliš nízká.",
71
+ "components.Input.error.validation.minLength": "Hodnota je příliš krátká.",
72
+ "components.Input.error.validation.minSupMax": "Nemůže být vyšší",
73
+ "components.Input.error.validation.regex": "Hodnota neodpovídá regulárnímu výrazu.",
74
+ "components.Input.error.validation.required": "Tato hodnota je povinná.",
75
+ "components.Input.error.validation.unique": "Tato hodnota už je použita.",
44
76
  "notification.success.submit": "Nastavení bylo aktualizování",
45
- "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento zásuvný modul obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
77
+ "page.title": "Nastavení - Role",
78
+ "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento plugin obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
46
79
  "plugin.description.short": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT",
47
- "plugin.name": "Role a oprávnění"
80
+ "plugin.name": "Role a oprávnění",
81
+ "popUpWarning.button.cancel": "Zrušit",
82
+ "popUpWarning.button.confirm": "Potvrdit",
83
+ "popUpWarning.title": "Prosím potvrďte",
84
+ "popUpWarning.warning.cancel": "Opravdu chcete zrušit své úpravy?"
48
85
  };
49
86
 
50
87
  module.exports = cs;
@@ -1 +1 @@
1
- {"version":3,"file":"cs.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cs.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,37 +12,74 @@ var cs = {
12
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "Adresa pro přesměrování",
13
13
  "EditForm.inputToggle.label.email-reset-password": "Stránka pro obnovení hesla",
14
14
  "EditForm.inputToggle.label.sign-up": "Povolit registrace",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "ex: https://yourfrontend.com/email-confirmation-redirection",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "ex: https://yourfrontend.com/reset-password",
17
+ "EditPage.form.roles": "Detaily role",
18
+ "Email.template.data.loaded": "E-mailové šablony byly načteny",
19
+ "Email.template.email_confirmation": "Potvrzení e-mailové adresy",
20
+ "Email.template.reset_password": "Obnovení hesla",
21
+ "Email.template.form.edit.label": "Upravit šablonu",
22
+ "Email.template.table.action.label": "akce",
23
+ "Email.template.table.icon.label": "ikona",
24
+ "Email.template.table.name.label": "název",
25
+ "Form.advancedSettings.data.loaded": "Data pokročilých nastavení byla načtena",
15
26
  "HeaderNav.link.advancedSettings": "Pokročilá nastavení",
16
27
  "HeaderNav.link.emailTemplates": "E-mailové šablony",
17
28
  "HeaderNav.link.providers": "Poskytovatelé",
18
- "Plugin.permissions.plugins.description": "Nastavit všechny akce pro zásuvný modul {name}.",
29
+ "Plugin.permissions.plugins.description": "Nastavit všechny akce pro plugin {name}.",
19
30
  "Plugins.header.description": "Pouze akce spojené s adresou jsou vypsány níže.",
20
31
  "Plugins.header.title": "Povolení",
21
- "Policies.header.hint": "Vyberte akce aplikace, nebo akce zásuvného modulu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
32
+ "Policies.header.hint": "Vyberte akce aplikace, nebo akce pluginu a klikněte na ikonku ozubeného kolečka pro zobrazení adresy s nimi spojenou.",
22
33
  "Policies.header.title": "Pokročilá nastavení",
23
34
  "PopUpForm.Email.email_templates.inputDescription": "Pokud si nejste jisti jak používat proměnné, {link}",
35
+ "PopUpForm.Email.link.documentation": "podívejte se do naší dokumentace.",
24
36
  "PopUpForm.Email.options.from.email.label": "Odesilatelův e-mail",
25
37
  "PopUpForm.Email.options.from.email.placeholder": "jannovak@gmail.com",
26
38
  "PopUpForm.Email.options.from.name.label": "Jméno odesilatele",
27
39
  "PopUpForm.Email.options.from.name.placeholder": "Jan Novák",
28
40
  "PopUpForm.Email.options.message.label": "Zpráva",
29
41
  "PopUpForm.Email.options.object.label": "Předmět",
42
+ "PopUpForm.Email.options.object.placeholder": "Potvrďte prosím svou e-mailovou adresu pro %APP_NAME%",
30
43
  "PopUpForm.Email.options.response_email.label": "Response e-mail",
31
44
  "PopUpForm.Email.options.response_email.placeholder": "jannovak@gmail.com",
32
- "PopUpForm.Providers.enabled.description": "If disabled, users won't be able to use this provider.",
45
+ "PopUpForm.Providers.enabled.description": "Pokud je zakázáno, uživatelé nebudou moci tohoto poskytovatele použít.",
33
46
  "PopUpForm.Providers.enabled.label": "Povolit",
34
47
  "PopUpForm.Providers.key.label": "Client ID",
35
48
  "PopUpForm.Providers.key.placeholder": "TEXT",
36
49
  "PopUpForm.Providers.redirectURL.front-end.label": "Adresa pro přesměrování na vaši front-end aplikaci",
50
+ "PopUpForm.Providers.redirectURL.label": "Adresa pro přesměrování, kterou je třeba přidat do konfigurace vaší aplikace {provider}",
37
51
  "PopUpForm.Providers.secret.label": "Client Secret",
38
52
  "PopUpForm.Providers.secret.placeholder": "TEXT",
39
53
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
40
54
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
41
55
  "PopUpForm.header.edit.email-templates": "Upravit e-mailové šablony",
56
+ "PopUpForm.header.edit.providers": "Upravit poskytovatele",
57
+ "Providers.data.loaded": "Poskytovatelé byli načteni",
58
+ "Providers.status": "Stav",
59
+ "Roles.empty": "Zatím nemáte žádné role.",
60
+ "Roles.empty.search": "Hledání neodpovídají žádné role.",
61
+ "Settings.roles.deleted": "Role smazána",
62
+ "Settings.roles.edited": "Role upravena",
63
+ "Settings.section-label": "Plugin Users & Permissions",
64
+ "components.Input.error.validation.email": "Toto není platný e-mail",
65
+ "components.Input.error.validation.json": "Toto neodpovídá formátu JSON",
66
+ "components.Input.error.validation.max": "Hodnota je příliš vysoká.",
67
+ "components.Input.error.validation.maxLength": "Hodnota je příliš dlouhá.",
68
+ "components.Input.error.validation.min": "Hodnota je příliš nízká.",
69
+ "components.Input.error.validation.minLength": "Hodnota je příliš krátká.",
70
+ "components.Input.error.validation.minSupMax": "Nemůže být vyšší",
71
+ "components.Input.error.validation.regex": "Hodnota neodpovídá regulárnímu výrazu.",
72
+ "components.Input.error.validation.required": "Tato hodnota je povinná.",
73
+ "components.Input.error.validation.unique": "Tato hodnota už je použita.",
42
74
  "notification.success.submit": "Nastavení bylo aktualizování",
43
- "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento zásuvný modul obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
75
+ "page.title": "Nastavení - Role",
76
+ "plugin.description.long": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT. Tento plugin obsahuje ACL strategii, která vám umožní spravovat oprávnění mezi skupinami uživatelů.",
44
77
  "plugin.description.short": "Chraňte své API pomocí kompletního autentifikačního procesu, založeného na JWT",
45
- "plugin.name": "Role a oprávnění"
78
+ "plugin.name": "Role a oprávnění",
79
+ "popUpWarning.button.cancel": "Zrušit",
80
+ "popUpWarning.button.confirm": "Potvrdit",
81
+ "popUpWarning.title": "Prosím potvrďte",
82
+ "popUpWarning.warning.cancel": "Opravdu chcete zrušit své úpravy?"
46
83
  };
47
84
 
48
85
  export { cs as default };
@@ -1 +1 @@
1
- {"version":3,"file":"cs.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cs.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -7,11 +7,24 @@ var nl = {
7
7
  "EditForm.inputToggle.description.email": "Zorg ervoor dat de gebruiker niet meerdere accounts kan maken met hetzelfde e-mailadres maar met verschillende leveranciers.",
8
8
  "EditForm.inputToggle.description.email-confirmation": "Wanneer ingeschakeld (ON), ontvangen nieuw geregistreerde gebruikers een bevestigingsmail.",
9
9
  "EditForm.inputToggle.description.email-confirmation-redirection": "Na het bevestigen van je e-mail, kies naar waar je doorgestuurd zal worden.",
10
+ "EditForm.inputToggle.description.email-reset-password": "URL van de wachtwoord-herstelpagina van je applicatie",
10
11
  "EditForm.inputToggle.description.sign-up": "Wanneer uitgeschakeld (OFF), is registratie verboden. Niemand kan abonneren ongeacht de leverancier",
11
12
  "EditForm.inputToggle.label.email": "Één account per e-mailadres.",
12
13
  "EditForm.inputToggle.label.email-confirmation": "Schakel emailbevestiging in",
13
14
  "EditForm.inputToggle.label.email-confirmation-redirection": "Doorstuur URL",
15
+ "EditForm.inputToggle.label.email-reset-password": "Wachtwoord-herstelpagina",
14
16
  "EditForm.inputToggle.label.sign-up": "Registratie inschakelen",
17
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "bijv.: https://uwfrontend.nl/e-mailbevestiging",
18
+ "EditForm.inputToggle.placeholder.email-reset-password": "bijv.: https://uwfrontend.nl/wachtwoord-herstellen",
19
+ "EditPage.form.roles": "Roldetails",
20
+ "Email.template.data.loaded": "E-mailtemplates zijn geladen",
21
+ "Email.template.email_confirmation": "E-mailadresbevestiging",
22
+ "Email.template.form.edit.label": "Een template bewerken",
23
+ "Email.template.reset_password": "Wachtwoord herstellen",
24
+ "Email.template.table.action.label": "actie",
25
+ "Email.template.table.icon.label": "pictogram",
26
+ "Email.template.table.name.label": "naam",
27
+ "Form.advancedSettings.data.loaded": "Geavanceerde instellingen zijn geladen",
15
28
  "HeaderNav.link.advancedSettings": "Geavanceerde instellingen",
16
29
  "HeaderNav.link.emailTemplates": "E-mail sjabloon",
17
30
  "HeaderNav.link.providers": "Leveranciers",
@@ -21,12 +34,14 @@ var nl = {
21
34
  "Policies.header.hint": "Selecteer de actie van de applicatie of de acties van de extensie en klik op het tandwiel icoontje om de gekoppelde route weer te geven",
22
35
  "Policies.header.title": "Geavanceerde instellingen",
23
36
  "PopUpForm.Email.email_templates.inputDescription": "Als je niet zeker weet hoe je variabelen moet gebruiken, {link}",
37
+ "PopUpForm.Email.link.documentation": "bekijk onze documentatie.",
24
38
  "PopUpForm.Email.options.from.email.label": "Afzender e-mail",
25
39
  "PopUpForm.Email.options.from.email.placeholder": "kai@doe.com",
26
40
  "PopUpForm.Email.options.from.name.label": "Afzender naam",
27
41
  "PopUpForm.Email.options.from.name.placeholder": "Kai Doe",
28
42
  "PopUpForm.Email.options.message.label": "Bericht",
29
43
  "PopUpForm.Email.options.object.label": "Onderwerp",
44
+ "PopUpForm.Email.options.object.placeholder": "Bevestig je e-mailadres voor %APP_NAME%",
30
45
  "PopUpForm.Email.options.response_email.label": "Antwoord e-mail",
31
46
  "PopUpForm.Email.options.response_email.placeholder": "kai@doe.com",
32
47
  "PopUpForm.Providers.enabled.description": "Als deze uitgeschakeld is kunnen gebruikers geen gebruik maken van deze leverancier.",
@@ -34,15 +49,39 @@ var nl = {
34
49
  "PopUpForm.Providers.key.label": "Client ID",
35
50
  "PopUpForm.Providers.key.placeholder": "TEXT",
36
51
  "PopUpForm.Providers.redirectURL.front-end.label": "De doorstuur URL voor jouw front-end app",
52
+ "PopUpForm.Providers.redirectURL.label": "De redirect-URL om toe te voegen in je {provider}-applicatieconfiguratie",
37
53
  "PopUpForm.Providers.secret.label": "Client Secret",
38
54
  "PopUpForm.Providers.secret.placeholder": "TEXT",
39
55
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
40
56
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
41
57
  "PopUpForm.header.edit.email-templates": "E-mail sjablonen aanpassen",
58
+ "PopUpForm.header.edit.providers": "Provider bewerken",
59
+ "Providers.data.loaded": "Providers zijn geladen",
60
+ "Providers.status": "Status",
61
+ "Roles.empty": "Je hebt nog geen rollen.",
62
+ "Roles.empty.search": "Geen rollen gevonden.",
63
+ "Settings.roles.deleted": "Rol verwijderd",
64
+ "Settings.roles.edited": "Rol bewerkt",
65
+ "Settings.section-label": "Users & Permissions plugin",
66
+ "components.Input.error.validation.email": "Dit is geen geldig e-mailadres",
67
+ "components.Input.error.validation.json": "Dit komt niet overeen met het JSON-formaat",
68
+ "components.Input.error.validation.max": "De waarde is te hoog.",
69
+ "components.Input.error.validation.maxLength": "De waarde is te lang.",
70
+ "components.Input.error.validation.min": "De waarde is te laag.",
71
+ "components.Input.error.validation.minLength": "De waarde is te kort.",
72
+ "components.Input.error.validation.minSupMax": "Kan niet hoger zijn",
73
+ "components.Input.error.validation.regex": "De waarde komt niet overeen met de regex.",
74
+ "components.Input.error.validation.required": "Deze waarde is verplicht.",
75
+ "components.Input.error.validation.unique": "Deze waarde is al in gebruik.",
42
76
  "notification.success.submit": "Instellingen zijn geüpdatet",
77
+ "page.title": "Instellingen - Rollen",
43
78
  "plugin.description.long": "Beveilig je API met een volledig authenticatie proces op JWT. Deze extensie komt ook met een ACL strategie welke ervoor zorgt dat je de permissies tussen groepen van gebruikers kan beheren.",
44
79
  "plugin.description.short": "Beveilig je API met een volledig authenticatie proces op JWT",
45
- "plugin.name": "Rollen & Permissies"
80
+ "plugin.name": "Rollen & Permissies",
81
+ "popUpWarning.button.cancel": "Annuleren",
82
+ "popUpWarning.button.confirm": "Bevestigen",
83
+ "popUpWarning.title": "Bevestig a.u.b.",
84
+ "popUpWarning.warning.cancel": "Weet je zeker dat je je wijzigingen wilt annuleren?"
46
85
  };
47
86
 
48
87
  module.exports = nl;
@@ -1 +1 @@
1
- {"version":3,"file":"nl.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"nl.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -5,11 +5,24 @@ var nl = {
5
5
  "EditForm.inputToggle.description.email": "Zorg ervoor dat de gebruiker niet meerdere accounts kan maken met hetzelfde e-mailadres maar met verschillende leveranciers.",
6
6
  "EditForm.inputToggle.description.email-confirmation": "Wanneer ingeschakeld (ON), ontvangen nieuw geregistreerde gebruikers een bevestigingsmail.",
7
7
  "EditForm.inputToggle.description.email-confirmation-redirection": "Na het bevestigen van je e-mail, kies naar waar je doorgestuurd zal worden.",
8
+ "EditForm.inputToggle.description.email-reset-password": "URL van de wachtwoord-herstelpagina van je applicatie",
8
9
  "EditForm.inputToggle.description.sign-up": "Wanneer uitgeschakeld (OFF), is registratie verboden. Niemand kan abonneren ongeacht de leverancier",
9
10
  "EditForm.inputToggle.label.email": "Één account per e-mailadres.",
10
11
  "EditForm.inputToggle.label.email-confirmation": "Schakel emailbevestiging in",
11
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "Doorstuur URL",
13
+ "EditForm.inputToggle.label.email-reset-password": "Wachtwoord-herstelpagina",
12
14
  "EditForm.inputToggle.label.sign-up": "Registratie inschakelen",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "bijv.: https://uwfrontend.nl/e-mailbevestiging",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "bijv.: https://uwfrontend.nl/wachtwoord-herstellen",
17
+ "EditPage.form.roles": "Roldetails",
18
+ "Email.template.data.loaded": "E-mailtemplates zijn geladen",
19
+ "Email.template.email_confirmation": "E-mailadresbevestiging",
20
+ "Email.template.form.edit.label": "Een template bewerken",
21
+ "Email.template.reset_password": "Wachtwoord herstellen",
22
+ "Email.template.table.action.label": "actie",
23
+ "Email.template.table.icon.label": "pictogram",
24
+ "Email.template.table.name.label": "naam",
25
+ "Form.advancedSettings.data.loaded": "Geavanceerde instellingen zijn geladen",
13
26
  "HeaderNav.link.advancedSettings": "Geavanceerde instellingen",
14
27
  "HeaderNav.link.emailTemplates": "E-mail sjabloon",
15
28
  "HeaderNav.link.providers": "Leveranciers",
@@ -19,12 +32,14 @@ var nl = {
19
32
  "Policies.header.hint": "Selecteer de actie van de applicatie of de acties van de extensie en klik op het tandwiel icoontje om de gekoppelde route weer te geven",
20
33
  "Policies.header.title": "Geavanceerde instellingen",
21
34
  "PopUpForm.Email.email_templates.inputDescription": "Als je niet zeker weet hoe je variabelen moet gebruiken, {link}",
35
+ "PopUpForm.Email.link.documentation": "bekijk onze documentatie.",
22
36
  "PopUpForm.Email.options.from.email.label": "Afzender e-mail",
23
37
  "PopUpForm.Email.options.from.email.placeholder": "kai@doe.com",
24
38
  "PopUpForm.Email.options.from.name.label": "Afzender naam",
25
39
  "PopUpForm.Email.options.from.name.placeholder": "Kai Doe",
26
40
  "PopUpForm.Email.options.message.label": "Bericht",
27
41
  "PopUpForm.Email.options.object.label": "Onderwerp",
42
+ "PopUpForm.Email.options.object.placeholder": "Bevestig je e-mailadres voor %APP_NAME%",
28
43
  "PopUpForm.Email.options.response_email.label": "Antwoord e-mail",
29
44
  "PopUpForm.Email.options.response_email.placeholder": "kai@doe.com",
30
45
  "PopUpForm.Providers.enabled.description": "Als deze uitgeschakeld is kunnen gebruikers geen gebruik maken van deze leverancier.",
@@ -32,15 +47,39 @@ var nl = {
32
47
  "PopUpForm.Providers.key.label": "Client ID",
33
48
  "PopUpForm.Providers.key.placeholder": "TEXT",
34
49
  "PopUpForm.Providers.redirectURL.front-end.label": "De doorstuur URL voor jouw front-end app",
50
+ "PopUpForm.Providers.redirectURL.label": "De redirect-URL om toe te voegen in je {provider}-applicatieconfiguratie",
35
51
  "PopUpForm.Providers.secret.label": "Client Secret",
36
52
  "PopUpForm.Providers.secret.placeholder": "TEXT",
37
53
  "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
38
54
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
39
55
  "PopUpForm.header.edit.email-templates": "E-mail sjablonen aanpassen",
56
+ "PopUpForm.header.edit.providers": "Provider bewerken",
57
+ "Providers.data.loaded": "Providers zijn geladen",
58
+ "Providers.status": "Status",
59
+ "Roles.empty": "Je hebt nog geen rollen.",
60
+ "Roles.empty.search": "Geen rollen gevonden.",
61
+ "Settings.roles.deleted": "Rol verwijderd",
62
+ "Settings.roles.edited": "Rol bewerkt",
63
+ "Settings.section-label": "Users & Permissions plugin",
64
+ "components.Input.error.validation.email": "Dit is geen geldig e-mailadres",
65
+ "components.Input.error.validation.json": "Dit komt niet overeen met het JSON-formaat",
66
+ "components.Input.error.validation.max": "De waarde is te hoog.",
67
+ "components.Input.error.validation.maxLength": "De waarde is te lang.",
68
+ "components.Input.error.validation.min": "De waarde is te laag.",
69
+ "components.Input.error.validation.minLength": "De waarde is te kort.",
70
+ "components.Input.error.validation.minSupMax": "Kan niet hoger zijn",
71
+ "components.Input.error.validation.regex": "De waarde komt niet overeen met de regex.",
72
+ "components.Input.error.validation.required": "Deze waarde is verplicht.",
73
+ "components.Input.error.validation.unique": "Deze waarde is al in gebruik.",
40
74
  "notification.success.submit": "Instellingen zijn geüpdatet",
75
+ "page.title": "Instellingen - Rollen",
41
76
  "plugin.description.long": "Beveilig je API met een volledig authenticatie proces op JWT. Deze extensie komt ook met een ACL strategie welke ervoor zorgt dat je de permissies tussen groepen van gebruikers kan beheren.",
42
77
  "plugin.description.short": "Beveilig je API met een volledig authenticatie proces op JWT",
43
- "plugin.name": "Rollen & Permissies"
78
+ "plugin.name": "Rollen & Permissies",
79
+ "popUpWarning.button.cancel": "Annuleren",
80
+ "popUpWarning.button.confirm": "Bevestigen",
81
+ "popUpWarning.title": "Bevestig a.u.b.",
82
+ "popUpWarning.warning.cancel": "Weet je zeker dat je je wijzigingen wilt annuleren?"
44
83
  };
45
84
 
46
85
  export { nl as default };
@@ -1 +1 @@
1
- {"version":3,"file":"nl.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"nl.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -14,7 +14,7 @@ function requireProviders() {
14
14
  */ // Public node modules.
15
15
  const _ = require$$0;
16
16
  const urlJoin = require$$2;
17
- const { getService } = index.__require();
17
+ const { getService, findValidUsername } = index.__require();
18
18
  providers = ({ strapi })=>{
19
19
  /**
20
20
  * Helper to get profiles
@@ -82,9 +82,13 @@ function requireProviders() {
82
82
  type: advancedSettings.default_role
83
83
  }
84
84
  });
85
+ // Username: prefer profile, else email prefix; findValidUsername ensures valid + unique
86
+ const base = profile.username && profile.username.trim() || email.split('@')[0];
87
+ const username = await findValidUsername(base);
85
88
  // Create the new user.
86
89
  const newUser = {
87
90
  ...profile,
91
+ username,
88
92
  email,
89
93
  provider,
90
94
  role: defaultRole.id,
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sources":["../../../server/services/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * Module dependencies\n */\n\n// Public node modules.\nconst _ = require('lodash');\nconst urlJoin = require('url-join');\n\nconst { getService } = require('../utils');\n\nmodule.exports = ({ strapi }) => {\n /**\n * Helper to get profiles\n *\n * @param {String} provider\n */\n\n const getProfile = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n const providers = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })\n .get();\n\n return getService('providers-registry').run({\n provider,\n query,\n accessToken,\n providers,\n });\n };\n\n /**\n * Connect thanks to a third-party provider.\n *\n *\n * @param {String} provider\n * @param {String} accessToken\n *\n * @return {*}\n */\n\n const connect = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n if (!accessToken) {\n throw new Error('No access_token.');\n }\n\n // Get the profile.\n const profile = await getProfile(provider, query);\n\n const email = _.toLower(profile.email);\n\n // We need at least the mail.\n if (!email) {\n throw new Error('Email was not available.');\n }\n\n const users = await strapi.db.query('plugin::users-permissions.user').findMany({\n where: { email },\n });\n\n const advancedSettings = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'advanced' })\n .get();\n\n const user = _.find(users, { provider });\n\n if (_.isEmpty(user) && !advancedSettings.allow_register) {\n throw new Error('Register action is actually not available.');\n }\n\n if (!_.isEmpty(user)) {\n return user;\n }\n\n if (users.length && advancedSettings.unique_email) {\n throw new Error('Email is already taken.');\n }\n\n // Retrieve default role.\n const defaultRole = await strapi.db\n .query('plugin::users-permissions.role')\n .findOne({ where: { type: advancedSettings.default_role } });\n\n // Create the new user.\n const newUser = {\n ...profile,\n email, // overwrite with lowercased email\n provider,\n role: defaultRole.id,\n confirmed: true,\n };\n\n const createdUser = await strapi.db\n .query('plugin::users-permissions.user')\n .create({ data: newUser });\n\n return createdUser;\n };\n\n const buildRedirectUri = (provider = '') => {\n const apiPrefix = strapi.config.get('api.rest.prefix');\n return urlJoin(\n strapi.config.get('server.absoluteUrl'),\n apiPrefix,\n 'connect',\n provider,\n 'callback'\n );\n };\n\n return {\n connect,\n buildRedirectUri,\n };\n};\n"],"names":["_","require$$0","urlJoin","require$$1","getService","require$$2","providers","strapi","getProfile","provider","query","accessToken","access_token","code","oauth_token","store","type","name","key","get","run","connect","Error","profile","email","toLower","users","db","findMany","where","advancedSettings","user","find","isEmpty","allow_register","length","unique_email","defaultRole","findOne","default_role","newUser","role","id","confirmed","createdUser","create","data","buildRedirectUri","apiPrefix","config"],"mappings":";;;;;;;;;;;AAEA;;AAEA;AAGA,IAAA,MAAMA,CAAAA,GAAIC,UAAAA;AACV,IAAA,MAAMC,OAAAA,GAAUC,UAAAA;IAEhB,MAAM,EAAEC,UAAU,EAAE,GAAGC,eAAAA,EAAAA;IAEvBC,SAAAA,GAAiB,CAAC,EAAEC,MAAM,EAAE,GAAA;AAC5B;;;;OAME,MAAMC,UAAAA,GAAa,OAAOC,QAAAA,EAAUC,KAAAA,GAAAA;YAClC,MAAMC,WAAAA,GAAcD,MAAME,YAAY,IAAIF,MAAMG,IAAI,IAAIH,MAAMI,WAAW;AAEzE,YAAA,MAAMR,SAAAA,GAAY,MAAMC,MAAAA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BAAA,CAAA,EAClB6B,SAAAA,EACA,SAAA,EACAvC,QAAAA,EACA,UAAA,CAAA;AAEN,QAAA,CAAA;QAEE,OAAO;AACLY,YAAAA,OAAAA;AACA0B,YAAAA;AACJ,SAAA;AACA,IAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"providers.js","sources":["../../../server/services/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * Module dependencies\n */\n\n// Public node modules.\nconst _ = require('lodash');\nconst urlJoin = require('url-join');\n\nconst { getService, findValidUsername } = require('../utils');\n\nmodule.exports = ({ strapi }) => {\n /**\n * Helper to get profiles\n *\n * @param {String} provider\n */\n\n const getProfile = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n const providers = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })\n .get();\n\n return getService('providers-registry').run({\n provider,\n query,\n accessToken,\n providers,\n });\n };\n\n /**\n * Connect thanks to a third-party provider.\n *\n *\n * @param {String} provider\n * @param {String} accessToken\n *\n * @return {*}\n */\n\n const connect = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n if (!accessToken) {\n throw new Error('No access_token.');\n }\n\n // Get the profile.\n const profile = await getProfile(provider, query);\n\n const email = _.toLower(profile.email);\n\n // We need at least the mail.\n if (!email) {\n throw new Error('Email was not available.');\n }\n\n const users = await strapi.db.query('plugin::users-permissions.user').findMany({\n where: { email },\n });\n\n const advancedSettings = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'advanced' })\n .get();\n\n const user = _.find(users, { provider });\n\n if (_.isEmpty(user) && !advancedSettings.allow_register) {\n throw new Error('Register action is actually not available.');\n }\n\n if (!_.isEmpty(user)) {\n return user;\n }\n\n if (users.length && advancedSettings.unique_email) {\n throw new Error('Email is already taken.');\n }\n\n // Retrieve default role.\n const defaultRole = await strapi.db\n .query('plugin::users-permissions.role')\n .findOne({ where: { type: advancedSettings.default_role } });\n\n // Username: prefer profile, else email prefix; findValidUsername ensures valid + unique\n const base = (profile.username && profile.username.trim()) || email.split('@')[0];\n const username = await findValidUsername(base);\n\n // Create the new user.\n const newUser = {\n ...profile,\n username, // use the generated or provided username\n email, // overwrite with lowercased email\n provider,\n role: defaultRole.id,\n confirmed: true,\n };\n\n const createdUser = await strapi.db\n .query('plugin::users-permissions.user')\n .create({ data: newUser });\n\n return createdUser;\n };\n\n const buildRedirectUri = (provider = '') => {\n const apiPrefix = strapi.config.get('api.rest.prefix');\n return urlJoin(\n strapi.config.get('server.absoluteUrl'),\n apiPrefix,\n 'connect',\n provider,\n 'callback'\n );\n };\n\n return {\n connect,\n buildRedirectUri,\n };\n};\n"],"names":["_","require$$0","urlJoin","require$$1","getService","findValidUsername","require$$2","providers","strapi","getProfile","provider","query","accessToken","access_token","code","oauth_token","store","type","name","key","get","run","connect","Error","profile","email","toLower","users","db","findMany","where","advancedSettings","user","find","isEmpty","allow_register","length","unique_email","defaultRole","findOne","default_role","base","username","trim","split","newUser","role","id","confirmed","createdUser","create","data","buildRedirectUri","apiPrefix","config"],"mappings":";;;;;;;;;;;AAEA;;AAEA;AAGA,IAAA,MAAMA,CAAAA,GAAIC,UAAAA;AACV,IAAA,MAAMC,OAAAA,GAAUC,UAAAA;AAEhB,IAAA,MAAM,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,eAAAA,EAAAA;IAE1CC,SAAAA,GAAiB,CAAC,EAAEC,MAAM,EAAE,GAAA;AAC5B;;;;OAME,MAAMC,UAAAA,GAAa,OAAOC,QAAAA,EAAUC,KAAAA,GAAAA;YAClC,MAAMC,WAAAA,GAAcD,MAAME,YAAY,IAAIF,MAAMG,IAAI,IAAIH,MAAMI,WAAW;AAEzE,YAAA,MAAMR,SAAAA,GAAY,MAAMC,MAAAA,CACrBQ,KAAK,CAAC;gBAAEC,IAAAA,EAAM,QAAA;gBAAUC,IAAAA,EAAM,mBAAA;gBAAqBC,GAAAA,EAAK;AAAO,aAAA,CAAA,CAC/DC,GAAG,EAAA;YAEN,O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AA,CAAO8C,MAAM,CAAClC,GAAG,CAAC,iBAAA,CAAA;YACpC,OAAOlB,OAAAA,CACLM,OAAO8C,MAAM,CAAClC,GAAG,CAAC,oBAAA,CAAA,EAClBiC,SAAAA,EACA,SAAA,EACA3C,QAAAA,EACA,UAAA,CAAA;AAEN,QAAA,CAAA;QAEE,OAAO;AACLY,YAAAA,OAAAA;AACA8B,YAAAA;AACJ,SAAA;AACA,IAAA,CAAA;;;;;;"}
@@ -12,7 +12,7 @@ function requireProviders() {
12
12
  */ // Public node modules.
13
13
  const _ = require$$0;
14
14
  const urlJoin = require$$2;
15
- const { getService } = requireUtils();
15
+ const { getService, findValidUsername } = requireUtils();
16
16
  providers = ({ strapi })=>{
17
17
  /**
18
18
  * Helper to get profiles
@@ -80,9 +80,13 @@ function requireProviders() {
80
80
  type: advancedSettings.default_role
81
81
  }
82
82
  });
83
+ // Username: prefer profile, else email prefix; findValidUsername ensures valid + unique
84
+ const base = profile.username && profile.username.trim() || email.split('@')[0];
85
+ const username = await findValidUsername(base);
83
86
  // Create the new user.
84
87
  const newUser = {
85
88
  ...profile,
89
+ username,
86
90
  email,
87
91
  provider,
88
92
  role: defaultRole.id,
@@ -1 +1 @@
1
- {"version":3,"file":"providers.mjs","sources":["../../../server/services/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * Module dependencies\n */\n\n// Public node modules.\nconst _ = require('lodash');\nconst urlJoin = require('url-join');\n\nconst { getService } = require('../utils');\n\nmodule.exports = ({ strapi }) => {\n /**\n * Helper to get profiles\n *\n * @param {String} provider\n */\n\n const getProfile = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n const providers = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })\n .get();\n\n return getService('providers-registry').run({\n provider,\n query,\n accessToken,\n providers,\n });\n };\n\n /**\n * Connect thanks to a third-party provider.\n *\n *\n * @param {String} provider\n * @param {String} accessToken\n *\n * @return {*}\n */\n\n const connect = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n if (!accessToken) {\n throw new Error('No access_token.');\n }\n\n // Get the profile.\n const profile = await getProfile(provider, query);\n\n const email = _.toLower(profile.email);\n\n // We need at least the mail.\n if (!email) {\n throw new Error('Email was not available.');\n }\n\n const users = await strapi.db.query('plugin::users-permissions.user').findMany({\n where: { email },\n });\n\n const advancedSettings = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'advanced' })\n .get();\n\n const user = _.find(users, { provider });\n\n if (_.isEmpty(user) && !advancedSettings.allow_register) {\n throw new Error('Register action is actually not available.');\n }\n\n if (!_.isEmpty(user)) {\n return user;\n }\n\n if (users.length && advancedSettings.unique_email) {\n throw new Error('Email is already taken.');\n }\n\n // Retrieve default role.\n const defaultRole = await strapi.db\n .query('plugin::users-permissions.role')\n .findOne({ where: { type: advancedSettings.default_role } });\n\n // Create the new user.\n const newUser = {\n ...profile,\n email, // overwrite with lowercased email\n provider,\n role: defaultRole.id,\n confirmed: true,\n };\n\n const createdUser = await strapi.db\n .query('plugin::users-permissions.user')\n .create({ data: newUser });\n\n return createdUser;\n };\n\n const buildRedirectUri = (provider = '') => {\n const apiPrefix = strapi.config.get('api.rest.prefix');\n return urlJoin(\n strapi.config.get('server.absoluteUrl'),\n apiPrefix,\n 'connect',\n provider,\n 'callback'\n );\n };\n\n return {\n connect,\n buildRedirectUri,\n };\n};\n"],"names":["_","require$$0","urlJoin","require$$1","getService","require$$2","providers","strapi","getProfile","provider","query","accessToken","access_token","code","oauth_token","store","type","name","key","get","run","connect","Error","profile","email","toLower","users","db","findMany","where","advancedSettings","user","find","isEmpty","allow_register","length","unique_email","defaultRole","findOne","default_role","newUser","role","id","confirmed","createdUser","create","data","buildRedirectUri","apiPrefix","config"],"mappings":";;;;;;;;;AAEA;;AAEA;AAGA,IAAA,MAAMA,CAAAA,GAAIC,UAAAA;AACV,IAAA,MAAMC,OAAAA,GAAUC,UAAAA;IAEhB,MAAM,EAAEC,UAAU,EAAE,GAAGC,Y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AAA,EAAMN;;YAElB,OAAOI,WAAAA;AACX,QAAA,CAAA;QAEE,MAAMG,gBAAAA,GAAmB,CAACtC,QAAAA,GAAW,EAAE,GAAA;AACrC,YAAA,MAAMuC,SAAAA,GAAYzC,MAAAA,CAAO0C,MAAM,CAAC9B,GAAG,CAAC,iBAAA,CAAA;YACpC,OAAOjB,OAAAA,CACLK,OAAO0C,MAAM,CAAC9B,GAAG,CAAC,oBAAA,CAAA,EAClB6B,SAAAA,EACA,SAAA,EACAvC,QAAAA,EACA,UAAA,CAAA;AAEN,QAAA,CAAA;QAEE,OAAO;AACLY,YAAAA,OAAAA;AACA0B,YAAAA;AACJ,SAAA;AACA,IAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"providers.mjs","sources":["../../../server/services/providers.js"],"sourcesContent":["'use strict';\n\n/**\n * Module dependencies\n */\n\n// Public node modules.\nconst _ = require('lodash');\nconst urlJoin = require('url-join');\n\nconst { getService, findValidUsername } = require('../utils');\n\nmodule.exports = ({ strapi }) => {\n /**\n * Helper to get profiles\n *\n * @param {String} provider\n */\n\n const getProfile = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n const providers = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })\n .get();\n\n return getService('providers-registry').run({\n provider,\n query,\n accessToken,\n providers,\n });\n };\n\n /**\n * Connect thanks to a third-party provider.\n *\n *\n * @param {String} provider\n * @param {String} accessToken\n *\n * @return {*}\n */\n\n const connect = async (provider, query) => {\n const accessToken = query.access_token || query.code || query.oauth_token;\n\n if (!accessToken) {\n throw new Error('No access_token.');\n }\n\n // Get the profile.\n const profile = await getProfile(provider, query);\n\n const email = _.toLower(profile.email);\n\n // We need at least the mail.\n if (!email) {\n throw new Error('Email was not available.');\n }\n\n const users = await strapi.db.query('plugin::users-permissions.user').findMany({\n where: { email },\n });\n\n const advancedSettings = await strapi\n .store({ type: 'plugin', name: 'users-permissions', key: 'advanced' })\n .get();\n\n const user = _.find(users, { provider });\n\n if (_.isEmpty(user) && !advancedSettings.allow_register) {\n throw new Error('Register action is actually not available.');\n }\n\n if (!_.isEmpty(user)) {\n return user;\n }\n\n if (users.length && advancedSettings.unique_email) {\n throw new Error('Email is already taken.');\n }\n\n // Retrieve default role.\n const defaultRole = await strapi.db\n .query('plugin::users-permissions.role')\n .findOne({ where: { type: advancedSettings.default_role } });\n\n // Username: prefer profile, else email prefix; findValidUsername ensures valid + unique\n const base = (profile.username && profile.username.trim()) || email.split('@')[0];\n const username = await findValidUsername(base);\n\n // Create the new user.\n const newUser = {\n ...profile,\n username, // use the generated or provided username\n email, // overwrite with lowercased email\n provider,\n role: defaultRole.id,\n confirmed: true,\n };\n\n const createdUser = await strapi.db\n .query('plugin::users-permissions.user')\n .create({ data: newUser });\n\n return createdUser;\n };\n\n const buildRedirectUri = (provider = '') => {\n const apiPrefix = strapi.config.get('api.rest.prefix');\n return urlJoin(\n strapi.config.get('server.absoluteUrl'),\n apiPrefix,\n 'connect',\n provider,\n 'callback'\n );\n };\n\n return {\n connect,\n buildRedirectUri,\n };\n};\n"],"names":["_","require$$0","urlJoin","require$$1","getService","findValidUsername","require$$2","providers","strapi","getProfile","provider","query","accessToken","access_token","code","oauth_token","store","type","name","key","get","run","connect","Error","profile","email","toLower","users","db","findMany","where","advancedSettings","user","find","isEmpty","allow_register","length","unique_email","defaultRole","findOne","default_role","base","username","trim","split","newUser","role","id","confirmed","createdUser","create","data","buildRedirectUri","apiPrefix","config"],"mappings":";;;;;;;;;AAEA;;AAEA;AAGA,IAAA,MAAMA,CAAAA,GAAIC,UAAAA;AACV,IAAA,MAAMC,OAAAA,GAAUC,UAAAA;AAEhB,IAAA,MAAM,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,YAAAA,EAAAA;IAE1CC,SAAAA,GAAiB,CAAC,EAAEC,MAAM,EAAE,GAAA;AAC5B;;;;OAME,MAAMC,UAAAA,GAAa,OAAOC,QAAAA,EAAUC,KAAAA,GAAAA;YAClC,M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AAMC,WAAAA,GAAc,MAAMzC,MAAAA,CAAOoB,EAAA,CAC9BjB,KAAK,CAAC,gCAAA,CAAA,CACNuC,MAAM,CAAC;gBAAEC,IAAAA,EAAMN;;YAElB,OAAOI,WAAAA;AACX,QAAA,CAAA;QAEE,MAAMG,gBAAAA,GAAmB,CAAC1C,QAAAA,GAAW,EAAE,GAAA;AACrC,YAAA,MAAM2C,SAAAA,GAAY7C,MAAAA,CAAO8C,MAAM,CAAClC,GAAG,CAAC,iBAAA,CAAA;YACpC,OAAOlB,OAAAA,CACLM,OAAO8C,MAAM,CAAClC,GAAG,CAAC,oBAAA,CAAA,EAClBiC,SAAAA,EACA,SAAA,EACA3C,QAAAA,EACA,UAAA,CAAA;AAEN,QAAA,CAAA;QAEE,OAAO;AACLY,YAAAA,OAAAA;AACA8B,YAAAA;AACJ,SAAA;AACA,IAAA,CAAA;;;;;;"}
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var require$$0 = require('crypto');
3
4
  var index = require('./sanitize/index.js');
4
5
 
5
6
  var utils;
@@ -7,12 +8,37 @@ var hasRequiredUtils;
7
8
  function requireUtils() {
8
9
  if (hasRequiredUtils) return utils;
9
10
  hasRequiredUtils = 1;
11
+ const crypto = require$$0;
10
12
  const sanitize = index.__require();
13
+ const MAX_USERNAME_ATTEMPTS = 10;
11
14
  const getService = (name)=>{
12
15
  return strapi.plugin('users-permissions').service(name);
13
16
  };
17
+ const isUsernameTaken = async (username)=>{
18
+ const user = await strapi.db.query('plugin::users-permissions.user').findOne({
19
+ where: {
20
+ username
21
+ }
22
+ });
23
+ return Boolean(user);
24
+ };
25
+ const findValidUsername = async (basename)=>{
26
+ const minLength = strapi.getModel('plugin::users-permissions.user')?.attributes?.username?.minLength ?? 3;
27
+ const tryBasenameFirst = basename.length >= minLength;
28
+ let attempt = 0;
29
+ let candidate;
30
+ let taken;
31
+ do {
32
+ candidate = attempt === 0 && tryBasenameFirst ? basename : `${basename}${crypto.randomInt(1000, 9999)}`;
33
+ taken = await isUsernameTaken(candidate);
34
+ attempt += 1;
35
+ }while (taken && attempt <= MAX_USERNAME_ATTEMPTS)
36
+ return taken ? crypto.randomUUID() : candidate;
37
+ };
14
38
  utils = {
15
39
  getService,
40
+ isUsernameTaken,
41
+ findValidUsername,
16
42
  sanitize
17
43
  };
18
44
  return utils;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../server/utils/index.js"],"sourcesContent":["'use strict';\n\nconst sanitize = require('./sanitize');\n\nconst getService = (name) => {\n return strapi.plugin('users-permissions').service(name);\n};\n\nmodule.exports = {\n getService,\n sanitize,\n};\n"],"names":["sanitize","require$$0","getService","name","strapi","plugin","service","utils"],"mappings":";;;;;;;;;AAEA,IAAA,MAAMA,QAAAA,GAAWC,eAAAA,EAAAA;AAEjB,IAAA,MAAMC,aAAa,CAACC,IAAAA,GAAAA;AAClB,QAAA,OAAOC,MAAAA,CAAOC,MAAM,CAAC,mBAAA,CAAA,CAAqBC,OAAO,CAACH,IAAAA,CAAAA;AACpD,IAAA,CAAA;IAEAI,KAAAA,GAAiB;AACfL,QAAAA,UAAAA;AACAF,QAAAA;AACF,KAAA;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../server/utils/index.js"],"sourcesContent":["'use strict';\n\nconst crypto = require('crypto');\nconst sanitize = require('./sanitize');\n\nconst MAX_USERNAME_ATTEMPTS = 10;\n\nconst getService = (name) => {\n return strapi.plugin('users-permissions').service(name);\n};\n\nconst isUsernameTaken = async (username) => {\n const user = await strapi.db\n .query('plugin::users-permissions.user')\n .findOne({ where: { username } });\n return Boolean(user);\n};\n\nconst findValidUsername = async (basename) => {\n const minLength =\n strapi.getModel('plugin::users-permissions.user')?.attributes?.username?.minLength ?? 3;\n const tryBasenameFirst = basename.length >= minLength;\n\n let attempt = 0;\n let candidate;\n let taken;\n do {\n candidate =\n attempt === 0 && tryBasenameFirst ? basename : `${basename}${crypto.randomInt(1000, 9999)}`;\n taken = await isUsernameTaken(candidate);\n attempt += 1;\n } while (taken && attempt <= MAX_USERNAME_ATTEMPTS);\n\n return taken ? crypto.randomUUID() : candidate;\n};\n\nmodule.exports = {\n getService,\n isUsernameTaken,\n findValidUsername,\n sanitize,\n};\n"],"names":["crypto","require$$0","sanitize","require$$1","MAX_USERNAME_ATTEMPTS","getService","name","strapi","plugin","service","isUsernameTaken","username","user","db","query","findOne","where","Boolean","findValidUsername","basename","minLength","getModel","attributes","tryBasenameFirst","length","attempt","candidate","taken","randomInt","randomUUID","utils"],"mappings":";;;;;;;;;;AAEA,IAAA,MAAMA,MAAAA,GAASC,UAAAA;AACf,IAAA,MAAMC,QAAAA,GAAWC,eAAAA,EAAAA;AAEjB,IAAA,MAAMC,qBAAAA,GAAwB,EAAA;AAE9B,IAAA,MAAMC,aAAa,CAACC,IAAAA,GAAAA;AAClB,QAAA,OAAOC,MAAAA,CAAOC,MAAM,CAAC,mBAAA,CAAA,CAAqBC,OAAO,CAACH,IAAAA,CAAAA;AACpD,IAAA,CAAA;AAEA,IAAA,MAAMI,kBAAkB,OAAOC,QAAAA,GAAAA;QAC7B,MAAMC,IAAAA,GAAO,MAAML,MAAAA,CAAOM,EAAA,CACvBC,KAAK,CAAC,gCAAA,CAAA,CACNC,OAAO,CAAC;YAAEC,KAAAA,EAAO;AAAEL,gBAAAA;AAAQ;AAAE,SAAA,CAAA;AAChC,QAAA,OAAOM,OAAAA,CAAQL,IAAAA,CAAAA;AACjB,IAAA,CAAA;AAEA,IAAA,MAAMM,oBAAoB,OAAOC,QAAAA,GAAAA;AAC/B,QAAA,MAAMC,YACJb,MAAAA,CAAOc,QAAQ,CAAC,gCAAA,CAAA,EAAmCC,UAAAA,EAAYX,UAAUS,SAAAA,IAAa,CAAA;QACxF,MAAMG,gBAAAA,GAAmBJ,QAAAA,CAASK,MAAM,IAAIJ,SAAAA;AAE5C,QAAA,IAAIK,OAAAA,GAAU,CAAA;QACd,IAAIC,SAAAA;QACJ,IAAIC,KAAAA;QACJ,GAAG;YACDD,SAAAA,GACED,OAAAA,KAAY,CAAA,IAAKF,gBAAAA,GAAmBJ,QAAAA,GAAW,CAAA,EAAGA,WAAWnB,MAAAA,CAAO4B,SAAS,CAAC,IAAA,EAAM,IAAA,CAAA,CAAA,CAAO;AAC7FD,YAAAA,KAAAA,GAAQ,MAAMjB,eAAAA,CAAgBgB,SAAAA,CAAAA;YAC9BD,OAAAA,IAAW,CAAA;QACf,CAAA,OAAWE,KAAAA,IAASF,WAAWrB,qBAAAA;QAE7B,OAAOuB,KAAAA,GAAQ3B,MAAAA,CAAO6B,UAAU,EAAA,GAAKH,SAAAA;AACvC,IAAA,CAAA;IAEAI,KAAAA,GAAiB;AACfzB,QAAAA,UAAAA;AACAK,QAAAA,eAAAA;AACAQ,QAAAA,iBAAAA;AACAhB,QAAAA;AACF,KAAA;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import require$$0 from 'crypto';
1
2
  import { __require as requireSanitize } from './sanitize/index.mjs';
2
3
 
3
4
  var utils;
@@ -5,12 +6,37 @@ var hasRequiredUtils;
5
6
  function requireUtils() {
6
7
  if (hasRequiredUtils) return utils;
7
8
  hasRequiredUtils = 1;
9
+ const crypto = require$$0;
8
10
  const sanitize = requireSanitize();
11
+ const MAX_USERNAME_ATTEMPTS = 10;
9
12
  const getService = (name)=>{
10
13
  return strapi.plugin('users-permissions').service(name);
11
14
  };
15
+ const isUsernameTaken = async (username)=>{
16
+ const user = await strapi.db.query('plugin::users-permissions.user').findOne({
17
+ where: {
18
+ username
19
+ }
20
+ });
21
+ return Boolean(user);
22
+ };
23
+ const findValidUsername = async (basename)=>{
24
+ const minLength = strapi.getModel('plugin::users-permissions.user')?.attributes?.username?.minLength ?? 3;
25
+ const tryBasenameFirst = basename.length >= minLength;
26
+ let attempt = 0;
27
+ let candidate;
28
+ let taken;
29
+ do {
30
+ candidate = attempt === 0 && tryBasenameFirst ? basename : `${basename}${crypto.randomInt(1000, 9999)}`;
31
+ taken = await isUsernameTaken(candidate);
32
+ attempt += 1;
33
+ }while (taken && attempt <= MAX_USERNAME_ATTEMPTS)
34
+ return taken ? crypto.randomUUID() : candidate;
35
+ };
12
36
  utils = {
13
37
  getService,
38
+ isUsernameTaken,
39
+ findValidUsername,
14
40
  sanitize
15
41
  };
16
42
  return utils;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../server/utils/index.js"],"sourcesContent":["'use strict';\n\nconst sanitize = require('./sanitize');\n\nconst getService = (name) => {\n return strapi.plugin('users-permissions').service(name);\n};\n\nmodule.exports = {\n getService,\n sanitize,\n};\n"],"names":["sanitize","require$$0","getService","name","strapi","plugin","service","utils"],"mappings":";;;;;;;AAEA,IAAA,MAAMA,QAAAA,GAAWC,eAAAA,EAAAA;AAEjB,IAAA,MAAMC,aAAa,CAACC,IAAAA,GAAAA;AAClB,QAAA,OAAOC,MAAAA,CAAOC,MAAM,CAAC,mBAAA,CAAA,CAAqBC,OAAO,CAACH,IAAAA,CAAAA;AACpD,IAAA,CAAA;IAEAI,KAAAA,GAAiB;AACfL,QAAAA,UAAAA;AACAF,QAAAA;AACF,KAAA;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../server/utils/index.js"],"sourcesContent":["'use strict';\n\nconst crypto = require('crypto');\nconst sanitize = require('./sanitize');\n\nconst MAX_USERNAME_ATTEMPTS = 10;\n\nconst getService = (name) => {\n return strapi.plugin('users-permissions').service(name);\n};\n\nconst isUsernameTaken = async (username) => {\n const user = await strapi.db\n .query('plugin::users-permissions.user')\n .findOne({ where: { username } });\n return Boolean(user);\n};\n\nconst findValidUsername = async (basename) => {\n const minLength =\n strapi.getModel('plugin::users-permissions.user')?.attributes?.username?.minLength ?? 3;\n const tryBasenameFirst = basename.length >= minLength;\n\n let attempt = 0;\n let candidate;\n let taken;\n do {\n candidate =\n attempt === 0 && tryBasenameFirst ? basename : `${basename}${crypto.randomInt(1000, 9999)}`;\n taken = await isUsernameTaken(candidate);\n attempt += 1;\n } while (taken && attempt <= MAX_USERNAME_ATTEMPTS);\n\n return taken ? crypto.randomUUID() : candidate;\n};\n\nmodule.exports = {\n getService,\n isUsernameTaken,\n findValidUsername,\n sanitize,\n};\n"],"names":["crypto","require$$0","sanitize","require$$1","MAX_USERNAME_ATTEMPTS","getService","name","strapi","plugin","service","isUsernameTaken","username","user","db","query","findOne","where","Boolean","findValidUsername","basename","minLength","getModel","attributes","tryBasenameFirst","length","attempt","candidate","taken","randomInt","randomUUID","utils"],"mappings":";;;;;;;;AAEA,IAAA,MAAMA,MAAAA,GAASC,UAAAA;AACf,IAAA,MAAMC,QAAAA,GAAWC,eAAAA,EAAAA;AAEjB,IAAA,MAAMC,qBAAAA,GAAwB,EAAA;AAE9B,IAAA,MAAMC,aAAa,CAACC,IAAAA,GAAAA;AAClB,QAAA,OAAOC,MAAAA,CAAOC,MAAM,CAAC,mBAAA,CAAA,CAAqBC,OAAO,CAACH,IAAAA,CAAAA;AACpD,IAAA,CAAA;AAEA,IAAA,MAAMI,kBAAkB,OAAOC,QAAAA,GAAAA;QAC7B,MAAMC,IAAAA,GAAO,MAAML,MAAAA,CAAOM,EAAA,CACvBC,KAAK,CAAC,gCAAA,CAAA,CACNC,OAAO,CAAC;YAAEC,KAAAA,EAAO;AAAEL,gBAAAA;AAAQ;AAAE,SAAA,CAAA;AAChC,QAAA,OAAOM,OAAAA,CAAQL,IAAAA,CAAAA;AACjB,IAAA,CAAA;AAEA,IAAA,MAAMM,oBAAoB,OAAOC,QAAAA,GAAAA;AAC/B,QAAA,MAAMC,YACJb,MAAAA,CAAOc,QAAQ,CAAC,gCAAA,CAAA,EAAmCC,UAAAA,EAAYX,UAAUS,SAAAA,IAAa,CAAA;QACxF,MAAMG,gBAAAA,GAAmBJ,QAAAA,CAASK,MAAM,IAAIJ,SAAAA;AAE5C,QAAA,IAAIK,OAAAA,GAAU,CAAA;QACd,IAAIC,SAAAA;QACJ,IAAIC,KAAAA;QACJ,GAAG;YACDD,SAAAA,GACED,OAAAA,KAAY,CAAA,IAAKF,gBAAAA,GAAmBJ,QAAAA,GAAW,CAAA,EAAGA,WAAWnB,MAAAA,CAAO4B,SAAS,CAAC,IAAA,EAAM,IAAA,CAAA,CAAA,CAAO;AAC7FD,YAAAA,KAAAA,GAAQ,MAAMjB,eAAAA,CAAgBgB,SAAAA,CAAAA;YAC9BD,OAAAA,IAAW,CAAA;QACf,CAAA,OAAWE,KAAAA,IAASF,WAAWrB,qBAAAA;QAE7B,OAAOuB,KAAAA,GAAQ3B,MAAAA,CAAO6B,UAAU,EAAA,GAAKH,SAAAA;AACvC,IAAA,CAAA;IAEAI,KAAAA,GAAiB;AACfzB,QAAAA,UAAAA;AACAK,QAAAA,eAAAA;AACAQ,QAAAA,iBAAAA;AACAhB,QAAAA;AACF,KAAA;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "5.42.1",
3
+ "version": "5.44.0",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -55,10 +55,10 @@
55
55
  "dependencies": {
56
56
  "@strapi/design-system": "2.2.0",
57
57
  "@strapi/icons": "2.2.0",
58
- "@strapi/utils": "5.42.1",
58
+ "@strapi/utils": "5.44.0",
59
59
  "bcryptjs": "2.4.3",
60
60
  "formik": "2.4.5",
61
- "grant": "^5.4.8",
61
+ "grant": "5.4.24",
62
62
  "immer": "9.0.21",
63
63
  "jsonwebtoken": "9.0.0",
64
64
  "jwk-to-pem": "2.0.7",
@@ -75,7 +75,7 @@
75
75
  "zod": "3.25.67"
76
76
  },
77
77
  "devDependencies": {
78
- "@strapi/strapi": "5.42.1",
78
+ "@strapi/strapi": "5.44.0",
79
79
  "@testing-library/dom": "10.4.1",
80
80
  "@testing-library/react": "16.3.0",
81
81
  "@testing-library/user-event": "14.6.1",
@@ -8,7 +8,7 @@
8
8
  const _ = require('lodash');
9
9
  const urlJoin = require('url-join');
10
10
 
11
- const { getService } = require('../utils');
11
+ const { getService, findValidUsername } = require('../utils');
12
12
 
13
13
  module.exports = ({ strapi }) => {
14
14
  /**
@@ -86,9 +86,14 @@ module.exports = ({ strapi }) => {
86
86
  .query('plugin::users-permissions.role')
87
87
  .findOne({ where: { type: advancedSettings.default_role } });
88
88
 
89
+ // Username: prefer profile, else email prefix; findValidUsername ensures valid + unique
90
+ const base = (profile.username && profile.username.trim()) || email.split('@')[0];
91
+ const username = await findValidUsername(base);
92
+
89
93
  // Create the new user.
90
94
  const newUser = {
91
95
  ...profile,
96
+ username, // use the generated or provided username
92
97
  email, // overwrite with lowercased email
93
98
  provider,
94
99
  role: defaultRole.id,
@@ -17,3 +17,7 @@ type S = {
17
17
  };
18
18
 
19
19
  export function getService<T extends keyof S>(name: T): ReturnType<S[T]>;
20
+
21
+ export function isUsernameTaken(username: string): Promise<boolean>;
22
+
23
+ export function findValidUsername(basename: string): Promise<string>;
@@ -1,12 +1,42 @@
1
1
  'use strict';
2
2
 
3
+ const crypto = require('crypto');
3
4
  const sanitize = require('./sanitize');
4
5
 
6
+ const MAX_USERNAME_ATTEMPTS = 10;
7
+
5
8
  const getService = (name) => {
6
9
  return strapi.plugin('users-permissions').service(name);
7
10
  };
8
11
 
12
+ const isUsernameTaken = async (username) => {
13
+ const user = await strapi.db
14
+ .query('plugin::users-permissions.user')
15
+ .findOne({ where: { username } });
16
+ return Boolean(user);
17
+ };
18
+
19
+ const findValidUsername = async (basename) => {
20
+ const minLength =
21
+ strapi.getModel('plugin::users-permissions.user')?.attributes?.username?.minLength ?? 3;
22
+ const tryBasenameFirst = basename.length >= minLength;
23
+
24
+ let attempt = 0;
25
+ let candidate;
26
+ let taken;
27
+ do {
28
+ candidate =
29
+ attempt === 0 && tryBasenameFirst ? basename : `${basename}${crypto.randomInt(1000, 9999)}`;
30
+ taken = await isUsernameTaken(candidate);
31
+ attempt += 1;
32
+ } while (taken && attempt <= MAX_USERNAME_ATTEMPTS);
33
+
34
+ return taken ? crypto.randomUUID() : candidate;
35
+ };
36
+
9
37
  module.exports = {
10
38
  getService,
39
+ isUsernameTaken,
40
+ findValidUsername,
11
41
  sanitize,
12
42
  };