Skip to content

Commit 5a85cec

Browse files
Merge pull request #66 from InseeFr/fix-auth-roles-in-token
fix: auth roles in token & prevent special chars in label
2 parents 4655dcf + dba9717 commit 5a85cec

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "massive-attack",
3-
"version": "2.4.0",
3+
"version": "2.4.1",
44
"private": true,
55
"dependencies": {
66
"@material-ui/core": "^4.11.4",

src/components/requester/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ const Requester = () => {
301301
onChange={event => {
302302
const inputValue = event.target.value;
303303
const filteredInput = inputValue
304-
.replace(/_/g, '')
305-
.replace(/ /g, '')
306-
.replace(/\//g, '')
304+
.normalize('NFD')
305+
.replace(/[\u0300-\u036f]/g, '') // remove accents
306+
.replace(/[_ /'"`;:!?<>§*()[\]{}#&.]/g, '') // remove special characters
307307
.toUpperCase()
308308
.substring(0, 10);
309309
setCampaignLabel(filteredInput);

src/utils/hook/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useAuth = () => {
4545
firstName: userToken.given_name,
4646
lastName: userToken.family_name,
4747
id: userToken.preferred_username,
48-
roles: userToken.roles,
48+
roles: userToken.realm_access.roles,
4949
};
5050

5151
if (anyMatch(userInfo.roles, [...userRole, adminRole])) {

0 commit comments

Comments
 (0)