summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-16 12:05:58 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-16 12:05:58 +0200
commit2aba7e037d9cbdbe1ed7b39a11658b3ffce8ab6e (patch)
tree45a0c3497e372249e0d28fbef6d751adf55888d3 /app
parenta05fc42827c14083d912fdc22d06e6c012c0ac04 (diff)
Add a "toggle password" button during installation
Diffstat (limited to 'app')
-rw-r--r--app/install.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/app/install.php b/app/install.php
index 55b8a0065..8986e9965 100644
--- a/app/install.php
+++ b/app/install.php
@@ -608,7 +608,10 @@ function printStep2() {
<div class="form-group">
<label class="group-name" for="passwordPlain"><?php echo _t('password_form'); ?></label>
<div class="group-controls">
- <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $_SESSION['auth_type'] === 'form' ? ' required="required"' : ''; ?> />
+ <div class="stick">
+ <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $_SESSION['auth_type'] === 'form' ? ' required="required"' : ''; ?> />
+ <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo FreshRSS_Themes::icon('key'); ?></a>
+ </div>
<noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
</div>
</div>
@@ -622,6 +625,25 @@ function printStep2() {
</div>
<script>
+ function toggle_password() {
+ var button = this;
+ var passwordField = document.getElementById(button.getAttribute('data-toggle'));
+
+ passwordField.setAttribute('type', 'text');
+ button.className += ' active';
+
+ setTimeout(function() {
+ passwordField.setAttribute('type', 'password');
+ button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , '');
+ }, 2000);
+
+ return false;
+ }
+ toggles = document.getElementsByClassName('toggle-password');
+ for (var i = 0 ; i < toggles.length ; i++) {
+ toggles[i].addEventListener('click', toggle_password);
+ }
+
function auth_type_change() {
var auth_value = document.getElementById('auth_type').value,
password_input = document.getElementById('passwordPlain'),