Browse Source

Add password/token hide/show field

causefx 8 years ago
parent
commit
90be977102
3 changed files with 24 additions and 11 deletions
  1. 11 11
      api/functions/homepage-functions.php
  2. 10 0
      js/custom.js
  3. 3 0
      js/functions.js

+ 11 - 11
api/functions/homepage-functions.php

@@ -44,9 +44,9 @@ function buildHomepageItem($homepageItem){
 			}
 			break;
 		case 'homepageOrdercustomhtmlTwo':
-		if($GLOBALS['homepagCustomHTMLtwoEnabled'] && qualifyRequest($GLOBALS['homepagCustomHTMLtwoAuth']) ){
-			$item .= ($GLOBALS['customHTMLtwo'] !== '') ? $GLOBALS['customHTMLtwo'] : '';
-		}
+			if($GLOBALS['homepagCustomHTMLtwoEnabled'] && qualifyRequest($GLOBALS['homepagCustomHTMLtwoAuth']) ){
+				$item .= ($GLOBALS['customHTMLtwo'] !== '') ? $GLOBALS['customHTMLtwo'] : '';
+			}
 			break;
 		case 'homepageOrdernotice':
 
@@ -415,13 +415,13 @@ function getHomepageList(){
 						'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'plexToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['plexToken']
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'plexID',
                         'label' => 'Plex Machine',
                         'value' => $GLOBALS['plexID']
@@ -532,7 +532,7 @@ function getHomepageList(){
 						'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'embyToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['embyToken']
@@ -643,7 +643,7 @@ function getHomepageList(){
 						'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'sabnzbdToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['sabnzbdToken']
@@ -961,7 +961,7 @@ function getHomepageList(){
                         'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'sonarrToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['sonarrToken']
@@ -1050,7 +1050,7 @@ function getHomepageList(){
                         'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'radarrToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['radarrToken']
@@ -1139,7 +1139,7 @@ function getHomepageList(){
                         'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'couchpotatoToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['couchpotatoToken']
@@ -1214,7 +1214,7 @@ function getHomepageList(){
                         'placeholder' => 'http(s)://hostname:port'
                     ),
                     array(
-                        'type' => 'input',
+                        'type' => 'password-alt',
                         'name' => 'sickrageToken',
                         'label' => 'Token',
                         'value' => $GLOBALS['sickrageToken']

+ 10 - 0
js/custom.js

@@ -1579,6 +1579,16 @@ $(document).on("click", ".purgeLog", function () {
 var log = $('.swapLog.active').attr('data-name');
 alert('This action is not set yet - but this would have purged the '+log+' log');
 });
+//Show Passowrd
+$(document).on("click", ".showPassword", function () {
+    var toggle = $(this).parent().parent().find('.password-alt');
+    if (toggle.attr('type') === "password") {
+        toggle.attr('type', 'text');
+    } else {
+        toggle.attr('type', 'password');
+    }
+    $(this).find('.passwordToggle').toggleClass('fa-eye').toggleClass('fa-eye-slash');
+});
 
 // calendar popups
 $(document).on('click', "a[class*=ID-]", function(){

+ 3 - 0
js/functions.js

@@ -551,6 +551,9 @@ function buildFormItem(item){
 		case 'password':
 			return '<input data-changed="false" lang=en" type="password" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" />';
 			break;
+		case 'password-alt':
+			return '<div class="input-group m-b-30"><input data-changed="false" lang=en" type="password" class="password-alt form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" /><span class="input-group-btn"> <button class="btn btn-default showPassword" type="button"><i class="fa fa-eye passwordToggle"></i></button></span></div>';
+			break;
 		case 'hidden':
 			return '<input data-changed="false" lang=en" type="hidden" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' />';
 			break;