Skip to content
Snippets Groups Projects
Commit 278ece5c authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Change pubkey preview

parent 377e8588
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
var co = require('co');
module.exports = ($scope, BMA) => {
module.exports = ($scope, $timeout, BMA) => {
setTimeout(() => {
$('select').material_select();
......@@ -15,14 +15,32 @@ module.exports = ($scope, BMA) => {
}
};
let concat = "";
$scope.pubkey_preview = "";
let timeout = preview();
function preview() {
return $timeout(() => {
if ($scope.$parent) {
let salt = $scope.$parent.conf.idty_entropy;
let pass = $scope.$parent.conf.idty_password;
let newConcat = [salt, pass].join('');
if (salt && pass && newConcat != concat) {
console.log('different');
concat = newConcat;
$scope.previewPubkey(concat);
timeout = preview();
} else {
timeout = preview();
}
}
}, 100);
}
$scope.previewPubkey = () => co(function *() {
let data = yield BMA.webmin.key.preview({
conf: $scope.$parent.conf
});
$scope.$parent.pubkey_preview = data.pubkey;
let modal = $('#modal-pubkey');
if (modal.css('display') == 'none') {
$('#modal-pubkey').openModal();
}
});
$scope.pubkey_preview = data.pubkey;
}).catch(() => null);
};
......@@ -79,6 +79,7 @@
"configuration.create_root.need_a_try": "You need to generate a first block with the « Give a try » button. Start HTTP server to do so.",
"configuration.create_root.button.accept_and_send": "Accept this block and start currency",
"configuration.create_root.button.cancel": "Cancel creation and go to home screen",
"configuration.create_uid.pubkey_preview": "Public key preview",
"home.current.number": "Current block #",
"home.current.membersCount": "Members count",
"home.current.medianTime": "Median time",
......
.row
.input-field.col.s12
i.material-icons.prefix vpn_key
input#idty_entropy.tooltipped(type="text" ng-model="$parent.conf.idty_entropy" data-position="top" data-tooltip="{{ 'configuration.create_uid.entropy.tooltip' | translate }}")
input#idty_entropy.tooltipped(type="text" ng-model="$parent.conf.idty_password" data-position="top" data-tooltip="{{ 'configuration.create_uid.entropy.tooltip' | translate }}")
label(for="idty_entropy") Entropy
.input-field.col.s12
i.material-icons.prefix vpn_key
input#idty_password.tooltipped(type="password" ng-model="$parent.conf.idty_password" data-position="top" data-tooltip="{{ 'configuration.create_uid.password.tooltip' | translate }}")
input#idty_password.tooltipped(type="password" ng-model="$parent.conf.idty_entropy" data-position="top" data-tooltip="{{ 'configuration.create_uid.password.tooltip' | translate }}")
label(for="idty_password") Password
.input-field.col.s12
select(disabled)
option(value="" disabled translate="general.choose_option")
option(value="1" selected translate="configuration.create_uid.nrp_algo_choose_1")
label {{ 'configuration.create_uid.nrp_algo_choose' | translate }}
.input-field.col.s12
.container(ng-if="pubkey_preview")
h5(translate="configuration.create_uid.pubkey_preview")
pre.pubkey {{ pubkey_preview }}
......@@ -16,9 +16,6 @@
include ../../includes/key
.row
button.btn-large.waves-effect.waves-light(ng-disabled="!$parent.conf.idty_entropy || !$parent.conf.idty_password" ng-click="previewPubkey()")
i.left.fa.fa-photo
span(translate="configuration.create_uid.preview_button")
button.btn-large.waves-effect.waves-light(ng-disabled="!$parent.conf.idty_uid || !$parent.conf.idty_entropy || !$parent.conf.idty_password" ng-click="accept()")
span(translate="configuration.create_uid.create_button")
......
......@@ -9,8 +9,3 @@ main(ui-view="")
a.btn.modal-action.modal-close.waves-effect.waves-orange(ui-sref="configure.create.network")
i.material-icons.left done
="{{ 'configuration.create_uid.modal_agree' | translate }}"
#modal-pubkey.modal
.modal-content
h4 {{ 'configuration.create_uid.modal_preview_title' | translate }}
p {{ pubkey_preview }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment