mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-11-27 01:36:43 -05:00
Password peek 🫣
This commit is contained in:
parent
2b8b5d71d2
commit
f9c958da90
42 changed files with 203 additions and 9 deletions
|
|
@ -2132,7 +2132,7 @@ jQuery.PrivateBin = (function($) {
|
|||
// if so, we send the link to the shortener
|
||||
// we do not remove the button, in case shortener fails
|
||||
sendToShortener();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5674,6 +5674,48 @@ jQuery.PrivateBin = (function($) {
|
|||
return me;
|
||||
})();
|
||||
|
||||
/**
|
||||
*
|
||||
* @name PasswordPeek
|
||||
* @class
|
||||
*/
|
||||
const PasswordPeek = (function () {
|
||||
const me = {};
|
||||
|
||||
/**
|
||||
* Switch between visible and hidden password
|
||||
*
|
||||
* @name PasswordPeek.handleRevealButtonClick
|
||||
* @private
|
||||
* @function
|
||||
*/
|
||||
function handleRevealButtonClick() {
|
||||
const passwordInput = $(this).siblings('.input-password');
|
||||
const isHidden = passwordInput.attr('type') === 'password';
|
||||
|
||||
passwordInput.attr('type', isHidden ? 'text' : 'password');
|
||||
|
||||
const tooltip = I18n._(isHidden ? 'Hide password' : 'Show password as plain text. Warning: this will display your password on the screen.');
|
||||
|
||||
$(this).attr('title', tooltip);
|
||||
$(this).attr('aria-label', tooltip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*
|
||||
* @name PasswordPeek.init
|
||||
* @function
|
||||
*/
|
||||
me.init = function() {
|
||||
const revealButton = $('.toggle-password');
|
||||
|
||||
revealButton.click(handleRevealButtonClick);
|
||||
};
|
||||
|
||||
return me;
|
||||
})();
|
||||
|
||||
/**
|
||||
* (controller) main PrivateBin logic
|
||||
*
|
||||
|
|
@ -5922,6 +5964,7 @@ jQuery.PrivateBin = (function($) {
|
|||
TopNav.init();
|
||||
UiHelper.init();
|
||||
CopyToClipboard.init();
|
||||
PasswordPeek.init();
|
||||
|
||||
// check for legacy browsers before going any further
|
||||
if (!Legacy.Check.getInit()) {
|
||||
|
|
@ -5981,6 +6024,7 @@ jQuery.PrivateBin = (function($) {
|
|||
ServerInteraction: ServerInteraction,
|
||||
PasteEncrypter: PasteEncrypter,
|
||||
PasteDecrypter: PasteDecrypter,
|
||||
PasswordPeek: PasswordPeek,
|
||||
CopyToClipboard: CopyToClipboard,
|
||||
Controller: Controller
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue