1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-29 17:38:04 +01:00

nfc flag for yubi and duo mobile page

This commit is contained in:
Kyle Spearrin 2017-06-29 12:35:10 -04:00
parent 1d70434ed1
commit 547c7b8b70
5 changed files with 84 additions and 35 deletions

View File

@ -442,6 +442,7 @@ gulp.task('serve', function () {
connect.server({
port: 4001,
root: ['src'],
//https: true,
middleware: function (connect, opt) {
return [function (req, res, next) {
if (req.originalUrl.indexOf('app-id.json') > -1) {

View File

@ -145,7 +145,7 @@
<div ng-if="twoFactorProvider === null">
<p>
This account has two-factor login enabled, however, none of the configured two-factor providers are supported by this
This account has two-step login enabled, however, none of the configured two-step providers are supported by this
web browser.
</p>
Please use a supported web browser (such as Chrome) and/or add additional providers that are better supported

View File

@ -33,8 +33,7 @@
key1: model.key1.key,
key2: model.key2.key,
key3: model.key3.key,
key4: model.key4.key,
key5: model.key5.key,
nfc: model.nfc,
masterPasswordHash: _masterPasswordHash
}, function (response) {
$analytics.eventTrack('Saved Two-step YubiKey');
@ -79,14 +78,7 @@
key: response.Key3,
existingKey: padRight(response.Key3, '*', 44)
},
key4: {
key: response.Key4,
existingKey: padRight(response.Key4, '*', 44)
},
key5: {
key: response.Key5,
existingKey: padRight(response.Key5, '*', 44)
}
nfc: response.Nfc === true || !response.Enabled
};
}

View File

@ -69,7 +69,7 @@
</ol>
<hr />
<div class="form-group" show-errors>
<label for="key1">Key #1</label>
<label for="key1">YubiKey #1</label>
<span ng-if="updateModel.key1.existingKey">
<a href="#" class="btn btn-link btn-xs" stop-click ng-click="remove(updateModel.key1)">[remove]</a>
</span>
@ -80,7 +80,7 @@
ng-show="!updateModel.key1.existingKey" />
</div>
<div class="form-group" show-errors>
<label for="key2">Key #2</label>
<label for="key2">YubiKey #2</label>
<span ng-if="updateModel.key2.existingKey">
<a href="#" class="btn btn-link btn-xs" stop-click ng-click="remove(updateModel.key2)">[remove]</a>
</span>
@ -91,7 +91,7 @@
ng-show="!updateModel.key2.existingKey" />
</div>
<div class="form-group" show-errors>
<label for="key3">Key #3</label>
<label for="key3">YubiKey #3</label>
<span ng-if="updateModel.key3.existingKey">
<a href="#" class="btn btn-link btn-xs" stop-click ng-click="remove(updateModel.key3)">[remove]</a>
</span>
@ -101,28 +101,16 @@
<input type="password" id="key3" name="Key3" ng-model="updateModel.key3.key" class="form-control" api-field
ng-show="!updateModel.key3.existingKey" />
</div>
<div class="form-group" show-errors>
<label for="key4">Key #4</label>
<span ng-if="updateModel.key4.existingKey">
<a href="#" class="btn btn-link btn-xs" stop-click ng-click="remove(updateModel.key4)">[remove]</a>
</span>
<div ng-if="updateModel.key4.existingKey" class="monospaced">
{{updateModel.key4.existingKey}}
</div>
<input type="password" id="key4" name="Key4" ng-model="updateModel.key4.key" class="form-control" api-field
ng-show="!updateModel.key4.existingKey" />
</div>
<div class="form-group" show-errors>
<label for="key5">Key #5</label>
<span ng-if="updateModel.key5.existingKey">
<a href="#" class="btn btn-link btn-xs" stop-click ng-click="remove(updateModel.key5)">[remove]</a>
</span>
<div ng-if="updateModel.key5.existingKey" class="monospaced">
{{updateModel.key5.existingKey}}
</div>
<input type="password" id="key5" name="Key5" ng-model="updateModel.key5.key" class="form-control" api-field
ng-show="!updateModel.key5.existingKey" />
<strong>NFC Support</strong>
<div class="checkbox">
<label>
<input type="checkbox" name="Nfc" id="nfc" ng-model="updateModel.nfc" /> One of my keys supports NFC.
</label>
</div>
<p class="help-block">
If one of your YubiKeys supports NFC (such as a YubiKey NEO), you will be prompted on mobile devices whenever NFC
availability is detected.
</p>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="submitTwoStepForm.$loading || disableLoading">

68
src/duo-mobile.html Normal file
View File

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Duo Two-step Login</title>
<style>
html, body {
margin: 0;
padding: 0;
}
iframe {
display: block;
width: 100%;
height: 400px;
border: none;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script src="lib/duo/index.js"></script>
<script>
!(function () {
var frameElement = document.createElement('iframe');
frameElement.setAttribute('id', 'duo_iframe');
setFrameHeight();
document.body.appendChild(frameElement);
var hostParam = getQsParam('host');
var requestParam = getQsParam('request');
Duo.init({
host: hostParam,
sig_request: requestParam,
submit_callback: function (form) {
invokeCSCode(form.elements.sig_response.value);
}
});
window.onresize = setFrameHeight;
function setFrameHeight() {
frameElement.style.height = window.innerHeight + 'px';
}
})();
function getQsParam(name) {
var url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
function invokeCSCode(data) {
try {
invokeCSharpAction(data);
}
catch (err) {
}
}
</script>
</body>
</html>