@opengovsg/mockpass 4.0.3 → 4.0.5
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.
package/lib/express/sgid.js
CHANGED
|
@@ -136,9 +136,10 @@ function config(app, { showLoginPage, serviceProvider }) {
|
|
|
136
136
|
.final()
|
|
137
137
|
}
|
|
138
138
|
const encryptedNric = await encryptPayload(nric)
|
|
139
|
+
// sgID doesn't actually offer the openid scope yet
|
|
139
140
|
const scopesArr = scopes
|
|
140
141
|
.split(' ')
|
|
141
|
-
.filter((field) => field !== 'myinfo.nric_number')
|
|
142
|
+
.filter((field) => field !== 'openid' && field !== 'myinfo.nric_number')
|
|
142
143
|
console.info(`userinfo scopesArr ${scopesArr}`)
|
|
143
144
|
const myInfoFields = await Promise.all(
|
|
144
145
|
scopesArr.map((scope) =>
|
package/package.json
CHANGED
|
@@ -390,6 +390,22 @@ function myTrim(x) {
|
|
|
390
390
|
return x.replace(/(^[ \t]*\n)/gm, "");
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
+
/**
|
|
394
|
+
* This method listens to changes in userID entry to redirect user when id is clicked
|
|
395
|
+
*/
|
|
396
|
+
function redirectID() {
|
|
397
|
+
const idInput = document.getElementById("id-input");
|
|
398
|
+
const optionsList = document.getElementById("id-datalist");
|
|
399
|
+
let optionsMap = new Map();
|
|
400
|
+
for (let i=0; i<optionsList.options.length; i++) {
|
|
401
|
+
optionsMap.set(optionsList.options[i].value, optionsList.options[i].dataset.assertURL);
|
|
402
|
+
}
|
|
403
|
+
if (optionsMap.has(idInput.value)) {
|
|
404
|
+
const assertURL = optionsMap.get(idInput.value);
|
|
405
|
+
window.location.href = assertURL;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
393
409
|
/**
|
|
394
410
|
* This is generic method called for onkeypress action.
|
|
395
411
|
*
|
|
@@ -166,14 +166,12 @@
|
|
|
166
166
|
<div class="login-label">Log in</div>
|
|
167
167
|
<br>
|
|
168
168
|
<div class="dropdown" style="width: 100%; ">
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
</button>
|
|
172
|
-
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
169
|
+
<input id="id-input" list="id-datalist" class="btn btn-secondary dropdown-toggle" oninput="redirectID()" placeholder= "Select Username" style="width: 100%; border: 2px solid #ccc; border-radius: 5px; background: white; color: rgb(42, 45, 51); text-align: left;">
|
|
170
|
+
<datalist class="dropdown-menu" id="id-datalist" aria-labelledby="id-input" >
|
|
173
171
|
{{#values}}
|
|
174
|
-
<
|
|
172
|
+
<option value="{{ id }}" data-assertURL="{{ assertURL }}">{{ id }}</option>
|
|
175
173
|
{{/values}}
|
|
176
|
-
</
|
|
174
|
+
</datalist>
|
|
177
175
|
</div>
|
|
178
176
|
</div>
|
|
179
177
|
<div>
|