Skip to content

Commit f567101

Browse files
soun059longsleep
authored andcommitted
Add login hint support
Add login hint support as per oidc standard and prepopulate username.
1 parent 5dc7794 commit f567101

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

identifier/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"redux-logger": "^3.0.6",
2626
"redux-thunk": "^2.4.2",
2727
"render-if": "^0.1.1",
28+
"validator": "^13.12.0",
2829
"web-vitals": "^1.1.2"
2930
},
3031
"scripts": {
@@ -47,6 +48,7 @@
4748
"@types/react-dom": "^17.0.23",
4849
"@types/react-redux": "^7.1.25",
4950
"@types/redux-logger": "^3.0.12",
51+
"@types/validator": "^13",
5052
"@typescript-eslint/eslint-plugin": "^6.11.0",
5153
"@typescript-eslint/parser": "^6.9.0",
5254
"@typescript-eslint/typescript-estree": "^6.11.0",

identifier/src/containers/Login/Login.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ function Login(props) {
8383
history.replace(`/chooseaccount${history.location.search}${history.location.hash}`);
8484
return;
8585
}
86+
// Login Hint validation is done so as to update user name automatically based on login hint provided.
87+
if (query && query.login_hint) {
88+
if (validator.isEmail(query.login_hint) || validator.isEmail(`${query.login_hint}@example.com`)) {
89+
dispatch(updateInput("username", query.login_hint));
90+
}
91+
}
8692
}, [ /* no dependencies */ ]); // eslint-disable-line react-hooks/exhaustive-deps
8793

8894
const handleChange = (name) => (event) => {

identifier/yarn.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4090,6 +4090,13 @@ __metadata:
40904090
languageName: node
40914091
linkType: hard
40924092

4093+
"@types/validator@npm:^13":
4094+
version: 13.12.2
4095+
resolution: "@types/validator@npm:13.12.2"
4096+
checksum: 564f60cfe112b45e1d747245d1f80db999bbc372b2b6a1c5454441b02c3d6bffbfff4365a10c3cd7874197f14ca5779b435794c7600bdcb541da948405a3b21a
4097+
languageName: node
4098+
linkType: hard
4099+
40934100
"@types/yargs-parser@npm:*":
40944101
version: 21.0.0
40954102
resolution: "@types/yargs-parser@npm:21.0.0"
@@ -7705,6 +7712,7 @@ __metadata:
77057712
"@types/react-dom": "npm:^17.0.23"
77067713
"@types/react-redux": "npm:^7.1.25"
77077714
"@types/redux-logger": "npm:^3.0.12"
7715+
"@types/validator": "npm:^13"
77087716
"@typescript-eslint/eslint-plugin": "npm:^6.11.0"
77097717
"@typescript-eslint/parser": "npm:^6.9.0"
77107718
"@typescript-eslint/typescript-estree": "npm:^6.11.0"
@@ -7739,6 +7747,7 @@ __metadata:
77397747
source-map-explorer: "npm:^2.5.3"
77407748
terser: "npm:^5.30.4"
77417749
typescript: "npm:^5.2.2"
7750+
validator: "npm:^13.12.0"
77427751
vite: "npm:^4.5.2"
77437752
vite-plugin-checker: "npm:^0.6.2"
77447753
vite-plugin-eslint: "npm:^1.8.1"
@@ -11515,6 +11524,13 @@ __metadata:
1151511524
languageName: node
1151611525
linkType: hard
1151711526

11527+
"validator@npm:^13.12.0":
11528+
version: 13.12.0
11529+
resolution: "validator@npm:13.12.0"
11530+
checksum: db6eb0725e2b67d60d30073ae8573982713b5903195d031dc3c7db7e82df8b74e8c13baef8e2106d146d979599fd61a06cde1fec5c148e4abd53d52817ff0fd9
11531+
languageName: node
11532+
linkType: hard
11533+
1151811534
"value-equal@npm:^1.0.1":
1151911535
version: 1.0.1
1152011536
resolution: "value-equal@npm:1.0.1"

0 commit comments

Comments
 (0)