Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 9a3583c

Browse files
Merge pull request #61 from silinternational/develop
removed u2f detection and assume it will be done in other modules.
2 parents ed6f98f + 672d28d commit 9a3583c

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

themes/material/mfa/prompt-for-mfa-u2f.php

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,12 @@
66
<?php include __DIR__ . '/../common-head-elements.php' ?>
77

88
<script src="mfa-u2f-api.js"></script>
9-
<script src="bowser.1.8.0.min.js"></script>
109

1110
<script>
12-
function isU2fSupported() {
13-
var isSupported = (bowser.chrome && bowser.version >= 41) ||
14-
(bowser.firefox && bowser.version >= 58) ||
15-
(bowser.opera && bowser.version >= 39);
16-
17-
var nodeToShow = isSupported ? document.querySelector('#supported') :
18-
document.querySelector('#unsupported');
19-
20-
nodeToShow.classList.remove('hide');
21-
22-
return isSupported;
23-
}
24-
2511
function verifyU2f() {
2612
var u2fSignRequest = <?= json_encode($this->data['mfaOption']['data']) ?> || {};
2713

28-
u2f.sign(u2fSignRequest.appId, u2fSignRequest.challenge, [u2fSignRequest],
29-
handleU2fResponse);
14+
u2f.sign(u2fSignRequest.appId, u2fSignRequest.challenge, [u2fSignRequest], handleU2fResponse);
3015
}
3116

3217
function handleU2fResponse(u2fResponse) {
@@ -101,7 +86,10 @@ function createHiddenInput(name) {
10186
}
10287
</script>
10388
</head>
104-
<body class="gradient-bg" onload="if (isU2fSupported()) verifyU2f()">
89+
90+
<?php $isU2fSupported = $this->data['supportsU2f']; ?>
91+
92+
<body class="gradient-bg" onload="<?= $isU2fSupported ? 'verifyU2f()' : '' ?>">
10593
<div class="mdl-layout mdl-layout--fixed-header fill-viewport">
10694
<header class="mdl-layout__header">
10795
<div class="mdl-layout__header-row">
@@ -125,17 +113,19 @@ class="icon">
125113
</h1>
126114
</div>
127115

128-
<div class="mdl-card__title center hide" id="supported">
129-
<p class="mdl-card__subtitle-text center">
116+
<?php if ($isU2fSupported): ?>
117+
<div class="mdl-card__title">
118+
<p class="mdl-card__subtitle-text">
130119
<?= $this->t('{material:mfa:u2f_instructions}') ?>
131120
</p>
132121
</div>
133-
134-
<div class="mdl-card__title hide" id="unsupported">
122+
<?php else: ?>
123+
<div class="mdl-card__title">
135124
<p class="mdl-typography--text-center mdl-color-text--red">
136125
<?= $this->t('{material:mfa:u2f_unsupported}') ?>
137126
</p>
138127
</div>
128+
<?php endif; ?>
139129

140130
<?php
141131
$message = $this->data['errorMessage'];

www/bowser.1.8.0.min.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)