Public Access
Visitor sign in kiosk: multi-site, badge printing, WWCC expiry warnings, admin accounts with 2FA
This commit is contained in:
+19
-5
@@ -18,6 +18,7 @@ const state = {
|
||||
checkNumber: '',
|
||||
photo: null,
|
||||
frequentVisitorId: null,
|
||||
hasStoredPhoto: false,
|
||||
};
|
||||
|
||||
let hosts = [];
|
||||
@@ -143,6 +144,7 @@ function resetState() {
|
||||
checkNumber: '',
|
||||
photo: null,
|
||||
frequentVisitorId: null,
|
||||
hasStoredPhoto: false,
|
||||
});
|
||||
history = [];
|
||||
$$('#app input').forEach((i) => {
|
||||
@@ -312,8 +314,13 @@ function buildReview() {
|
||||
/* ------------------------------------------------------------ submits */
|
||||
|
||||
async function submitSignIn() {
|
||||
const button = state.mode === 'frequent' ? $('#cam-use') : $('#do-signin');
|
||||
button.disabled = true;
|
||||
// Called from the review screen, the camera screen, or straight from the host
|
||||
// list when a recurring visitor already has a photo on file.
|
||||
const button =
|
||||
(current === 'photo' && $('#cam-use')) ||
|
||||
(current === 'review' && $('#do-signin')) ||
|
||||
null;
|
||||
if (button) button.disabled = true;
|
||||
try {
|
||||
const result = await api('/api/signin', {
|
||||
mode: state.mode,
|
||||
@@ -342,7 +349,7 @@ async function submitSignIn() {
|
||||
} catch (err) {
|
||||
say(err.message);
|
||||
} finally {
|
||||
button.disabled = false;
|
||||
if (button) button.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,9 +508,14 @@ $('#do-freq-auth').addEventListener('click', async () => {
|
||||
state.frequentVisitorId = person.id;
|
||||
state.firstName = person.firstName;
|
||||
state.lastName = person.lastName;
|
||||
// With a photo already on file there is nothing to pose for: picking a host
|
||||
// completes the sign in and the pass prints straight away.
|
||||
state.hasStoredPhoto = Boolean(person.hasPhoto);
|
||||
$('#freq-greeting').textContent = `Hi ${person.firstName}. Who are you here to see?`;
|
||||
$('#in-freq-host-search').value = '';
|
||||
renderHosts($('#freq-host-list'), '', () => show('photo'));
|
||||
renderHosts($('#freq-host-list'), '', () =>
|
||||
state.hasStoredPhoto ? submitSignIn() : show('photo')
|
||||
);
|
||||
show('freq-host');
|
||||
} catch (err) {
|
||||
say(err.message);
|
||||
@@ -514,7 +526,9 @@ $('#do-freq-auth').addEventListener('click', async () => {
|
||||
});
|
||||
|
||||
$('#in-freq-host-search').addEventListener('input', (e) =>
|
||||
renderHosts($('#freq-host-list'), e.target.value, () => show('photo'))
|
||||
renderHosts($('#freq-host-list'), e.target.value, () =>
|
||||
state.hasStoredPhoto ? submitSignIn() : show('photo')
|
||||
)
|
||||
);
|
||||
|
||||
/* sign out */
|
||||
|
||||
Reference in New Issue
Block a user