mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
Merge branch 'aldem-modal-decryption-password' of https://github.com/aldem/PrivateBin into aldem-aldem-modal-decryption-password
This commit is contained in:
commit
f7feff50d8
@ -80,6 +80,10 @@
|
||||
["Dieses Dokument läuft in einem Monat ab.", "Dieses Dokument läuft in %d Monaten ab."],
|
||||
"Please enter the password for this paste:":
|
||||
"Bitte gib das Passwort für diesen Text ein:",
|
||||
"Decrypt":
|
||||
"Entschlüsseln",
|
||||
"Enter password":
|
||||
"Passwort eingeben",
|
||||
"Could not decrypt data (Wrong key?)":
|
||||
"Konnte Daten nicht entschlüsseln (Falscher Schlüssel?)",
|
||||
"Could not delete the paste, it was not stored in burn after reading mode.":
|
||||
|
@ -618,16 +618,7 @@ $(function() {
|
||||
*/
|
||||
requestPassword: function()
|
||||
{
|
||||
var password = prompt(i18n._('Please enter the password for this paste:'), '');
|
||||
if (password === null)
|
||||
{
|
||||
throw 'password prompt canceled';
|
||||
}
|
||||
if (password.length === 0)
|
||||
{
|
||||
return this.requestPassword();
|
||||
}
|
||||
return password;
|
||||
$("#passwordModal").modal();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -705,7 +696,7 @@ $(function() {
|
||||
{
|
||||
if (password.length === 0)
|
||||
{
|
||||
password = this.requestPassword();
|
||||
return this.requestPassword();
|
||||
}
|
||||
attachment = filter.decipher(key, password, paste.attachment);
|
||||
}
|
||||
@ -740,8 +731,7 @@ $(function() {
|
||||
var cleartext = filter.decipher(key, password, paste.data);
|
||||
if (cleartext.length === 0 && password.length === 0 && !paste.attachment)
|
||||
{
|
||||
password = this.requestPassword();
|
||||
cleartext = filter.decipher(key, password, paste.data);
|
||||
return this.requestPassword();
|
||||
}
|
||||
if (cleartext.length === 0 && !paste.attachment)
|
||||
{
|
||||
@ -1579,6 +1569,23 @@ $(function() {
|
||||
// Show proper elements on screen.
|
||||
this.stateExistingPaste();
|
||||
|
||||
{
|
||||
// This part of code handles modal password request on decryption
|
||||
// Inside of event handler, "this" is something different... so we have to save it
|
||||
var self = this;
|
||||
$("#passwordModal").on('shown.bs.modal', function() {
|
||||
$("#decryptPassword").focus();
|
||||
});
|
||||
$("#passwordForm").submit(function(){
|
||||
$("#passwordModal").modal("hide");
|
||||
return false;
|
||||
});
|
||||
$("#passwordModal").on("hidden.bs.modal", function(){
|
||||
self.passwordInput.val($("#decryptPassword").val());
|
||||
self.displayMessages(self.pageKey(), data);
|
||||
});
|
||||
}
|
||||
|
||||
this.displayMessages(this.pageKey(), data);
|
||||
}
|
||||
// Display error message from php code.
|
||||
|
@ -52,7 +52,7 @@ if ($MARKDOWN):
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-h/cw2lgocVvgjmYWShhbnz5nSzyUv4rVY1JgN7vmkZq8VJX9KVXPoC7oYX+YGFk+0FYw+c/uofVW9yyU5TJv+w==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-6NNTkh7KDhbUmY/iAB4wRgWtLQTuJjrfOp8Lawa9MqZrtNqGcMbWPjhkQn33RwGfO3+gHSrE19a9UWgG0ecc4w==" crossorigin="anonymous"></script>
|
||||
<!--[if lt IE 10]>
|
||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||
<![endif]-->
|
||||
@ -66,7 +66,25 @@ endif;
|
||||
<meta name="theme-color" content="#ffe57e" />
|
||||
</head>
|
||||
<body role="document">
|
||||
<nav class="navbar navbar-default navbar-static-top">
|
||||
<!-- Modal decryption password request -->
|
||||
<div class="modal fade" id="passwordModal" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<form role="form" id="passwordForm">
|
||||
<div class="form-group">
|
||||
<label for="decryptPassword"><span class="glyphicon glyphicon-eye-open"></span> <?php echo I18n::_('Please enter the password for this paste:') ?></label>
|
||||
<input type="password" class="form-control" id="decryptPassword" placeholder="<?php echo I18n::_('Enter password') ?>" autofocus>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-block"><span class="glyphicon glyphicon-off"></span> <?php echo I18n::_('Decrypt') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav class="navbar navbar-default navbar-static-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
|
||||
|
Loading…
Reference in New Issue
Block a user