]> source.dussan.org Git - nextcloud-server.git/commitdiff
load showpassord.js conditionally in the template only if needed
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 10 Dec 2014 15:59:03 +0000 (16:59 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 16 Dec 2014 17:45:37 +0000 (18:45 +0100)
core/js/installation.js [new file with mode: 0644]
core/js/js.js
core/templates/installation.php
lib/base.php
settings/js/personal.js
settings/templates/personal.php

diff --git a/core/js/installation.js b/core/js/installation.js
new file mode 100644 (file)
index 0000000..20ff346
--- /dev/null
@@ -0,0 +1,5 @@
+
+$(document).ready(function() {
+       $('#adminpass').showPassword().keyup();
+       $('#dbpass').showPassword().keyup();
+});
index f01c0eb77c12ca129655edb04967a9292cb05deb..57ce1ab695565f8aa8533b695fbfc7b101cdc4ee 100644 (file)
@@ -1081,35 +1081,6 @@ function initCore() {
                }
        });
 
-       var setShowPassword = function(input, label) {
-               input.showPassword().keyup();
-       };
-       setShowPassword($('#adminpass'), $('label[for=show]'));
-       setShowPassword($('#pass2'), $('label[for=personal-show]'));
-       setShowPassword($('#dbpass'), $('label[for=dbpassword]'));
-
-       var checkShowCredentials = function() {
-               var empty = false;
-               $('input#user, input#password').each(function() {
-                       if ($(this).val() === '') {
-                               empty = true;
-                       }
-               });
-               if(empty) {
-                       $('#submit').fadeOut();
-                       $('#remember_login').hide();
-                       $('#remember_login+label').fadeOut();
-               } else {
-                       $('#submit').fadeIn();
-                       $('#remember_login').show();
-                       $('#remember_login+label').fadeIn();
-               }
-       };
-       // hide log in button etc. when form fields not filled
-       // commented out due to some browsers having issues with it
-       // checkShowCredentials();
-       // $('input#user, input#password').keyup(checkShowCredentials);
-
        // user menu
        $('#settings #expand').keydown(function(event) {
                if (event.which === 13 || event.which === 32) {
index 9ef63dbfe8c88bb03127652416bd5966f71cee65..0b3b0d46c5c7a764c285b2f181e04bef9fe7eabf 100644 (file)
@@ -1,3 +1,9 @@
+<?php
+script('core', [
+       'jquery-showpassword',
+       'installation'
+]);
+?>
 <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
 <input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
 <input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
index 1dd259b0914a0c92195f72400e433d927b2211f0..aa536c263992e696c8f0a7ce7b669e6361f93609 100644 (file)
@@ -336,7 +336,6 @@ class OC {
 
        public static function initTemplateEngine() {
                // Add the stuff we need always
-
                // following logic will import all vendor libraries that are
                // specified in core/js/core.json
                $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
@@ -351,7 +350,6 @@ class OC {
                        throw new \Exception('Cannot read core/js/core.json');
                }
 
-               OC_Util::addScript("jquery-showpassword");
                OC_Util::addScript("placeholders");
                OC_Util::addScript("jquery-tipsy");
                OC_Util::addScript("compatibility");
index b2efa7c37f94ba1140033d96eb7f731cba79e6b0..ac29f69037e963ce086273b7cc65b7310626fce0 100644 (file)
@@ -157,6 +157,7 @@ function avatarResponseHandler (data) {
 }
 
 $(document).ready(function () {
+       $('#pass2').showPassword().keyup();
        $("#passwordbutton").click(function () {
                if ($('#pass1').val() !== '' && $('#pass2').val() !== '') {
                        // Serialize the data
index cc04de5ec38c44fbbea419a09cb526a52a9c9b36..913c5803f6d2c61891189a9bb391f29ab37303dc 100644 (file)
@@ -63,6 +63,7 @@
 
 <?php
 if($_['passwordChangeSupported']) {
+       script('jquery-showpassword');
 ?>
 <form id="passwordform" class="section">
        <h2><?php p($l->t('Password'));?></h2>