diff options
| author | 2015-01-13 11:16:13 +0100 | |
|---|---|---|
| committer | 2015-01-13 11:16:13 +0100 | |
| commit | 2d1cb016abb1ad2e5c9a875c649a702480f97b1b (patch) | |
| tree | fa576bd715779b07b55b67054046fec3e4d69763 /app | |
| parent | 2628197190e98cbb27db75bc603b88f51869f8db (diff) | |
Fix user interaction with showing password feature
Before, the password was hidden again after 2 seconds. Now, the password
is hidden when the mouse is released
Fix https://github.com/FreshRSS/FreshRSS/issues/734
Diffstat (limited to 'app')
| -rw-r--r-- | app/install.php | 17 | ||||
| -rw-r--r-- | app/views/user/manage.phtml | 2 | ||||
| -rw-r--r-- | app/views/user/profile.phtml | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/app/install.php b/app/install.php index a79b0d318..eb2f764f9 100644 --- a/app/install.php +++ b/app/install.php @@ -611,23 +611,26 @@ function printStep2() { </div> <script> - function toggle_password() { + function show_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; + } + function hide_password() { + var button = this; + var passwordField = document.getElementById(button.getAttribute('data-toggle')); + passwordField.setAttribute('type', 'password'); + button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , ''); return false; } toggles = document.getElementsByClassName('toggle-password'); for (var i = 0 ; i < toggles.length ; i++) { - toggles[i].addEventListener('click', toggle_password); + toggles[i].addEventListener('mousedown', show_password); + toggles[i].addEventListener('mouseup', hide_password); } function auth_type_change(focus) { diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 466446f2f..11562093e 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -30,7 +30,7 @@ <div class="group-controls"> <div class="stick"> <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" /> - <a class="btn toggle-password"><?php echo _i('key'); ?></a> + <a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a> </div> <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> </div> diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index d85499ad8..4e61664bc 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -22,7 +22,7 @@ <div class="group-controls"> <div class="stick"> <input type="password" id="passwordPlain" name="passwordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> - <a class="btn toggle-password"><?php echo _i('key'); ?></a> + <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo _i('key'); ?></a> </div> <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> </div> @@ -34,7 +34,7 @@ <div class="group-controls"> <div class="stick"> <input type="password" id="apiPasswordPlain" name="apiPasswordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> - <a class="btn toggle-password"><?php echo _i('key'); ?></a> + <a class="btn toggle-password" data-toggle="apiPasswordPlain"><?php echo _i('key'); ?></a> </div> </div> </div> |
