Merge pull request #593 from bergware/master

Users: Display Password Strength (take 2)
This commit is contained in:
tom mortensen
2020-02-19 12:23:30 -08:00
committed by GitHub
6 changed files with 265 additions and 58 deletions
+1 -1
View File
@@ -502,7 +502,7 @@ function formatWarning(val) {
<table class="array_status noshift">
<tr><td></td><td><input type="button" id="button-up" onclick="$('[id^=button-]').prop('disabled',true);toggle_state('up')" value="Spin Up"<?=$parity?' disabled':''?>><input type="button" id="button-down" onclick="$('[id^=button-]').prop('disabled',true);toggle_state('down')" value="Spin Down"<?=$parity?' disabled':''?>></td>
<td><strong>Spin Up</strong> will immediately spin up all disks.<br><strong>Spin Down</strong> will immediately spin down all disks.</td></tr>
<tr><td></td><td><input type="button" value="Clear" onclick="toggle_state('Clear')"></td><td><strong>Clear</strong> will immediately clear all disk statistics.</td></tr>
<tr><td></td><td><input type="button" value="Clear Stats" onclick="toggle_state('Clear')"></td><td><strong>Clear Stats</strong> will immediately clear all disk statistics.</td></tr>
<tr><td></td><td class="line" colspan="2"></td></tr>
</table>
<?if ($var['shareCacheEnabled']=="yes" && is_dir("/mnt/cache")):?>
+119 -38
View File
@@ -3,8 +3,8 @@ Title="$name Settings"
Tag="hdd-o"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -148,6 +148,68 @@ function setGlue(form,reset) {
$('#helptext').hide();
}
}
function prepareFS(form,cookie,value) {
if ($(form).find('input[type="submit"]').val()=='Cancel') $.removeCookie(cookie); else $.cookie(cookie,value);
}
function btrfsBalance(path) {
$.post('/webGui/include/FileSystemStatus.php',{cmd:'balance',path:path},function(data) {
if (data.indexOf('running')>0) {
$('#btrfs-balance').text(data);
setTimeout(function(){btrfsBalance(path);},1000);
} else {
$.removeCookie('btrfs-balance-<?=$disk['name']?>');
refresh();
}
});
}
function btrfsScrub(path) {
$.post('/webGui/include/FileSystemStatus.php',{cmd:'scrub',path:path},function(data) {
if (data.indexOf('running')>0) {
$('#btrfs-scrub').text(data);
setTimeout(function(){btrfsScrub(path);},1000);
} else {
$.removeCookie('btrfs-scrub-<?=$disk['name']?>');
refresh();
}
});
}
function btrfsCheck(path) {
$.post('/webGui/include/FileSystemStatus.php',{cmd:'btrfs',path:path},function(data) {
$('#btrfs-check').text(data);
if (data.slice(-1)!='\0') {
setTimeout(function(){btrfsCheck(path);},1000);
} else {
$.removeCookie('btrfs-check-<?=$disk['name']?>');
refresh();
}
});
}
function rfsCheck(path) {
$.post('/webGui/include/FileSystemStatus.php',{cmd:'rfs',path:path},function(data) {
$('#rfs-check').text(data);
if (data.slice(-1)!='\0') {
setTimeout(function(){rfsCheck(path);},1000);
} else {
$.removeCookie('rfs-check-<?=$disk['name']?>');
refresh();
}
});
}
function xfsCheck(path) {
$.post('/webGui/include/FileSystemStatus.php',{cmd:'xfs',path:path},function(data) {
$('#xfs-check').text(data);
if (data.slice(-1)!='\0') {
setTimeout(function(){xfsCheck(path);},1000);
} else {
$.removeCookie('xfs-check-<?=$disk['name']?>');
refresh();
}
});
}
function updateMode(form,mode) {
$(form).find('input[name="#arg[3]"]').val(mode);
if (mode.indexOf('raid5')>0||mode.indexOf('raid6')>0) $('#mode-warning').text('RAiD5/6 still has some issues and should be used for testing purposes only'); else $('#mode-warning').text('');
}
$(function() {
<?if (count($sheets)>1):?>
var ctrl = "<span class='status <?=$tabbed?'vhshift':'vshift'?>'><span class='waitmsg fa fa-circle-o-notch fa-span fa-fw' style='display:none;margin-right:8px'></span><a href='/Main/<?=$type?>?name=<?=$prev?>' title='previous device'>";
@@ -164,6 +226,11 @@ $(function() {
form.smType.selectedIndex = 0;
<?endif;?>
setGlue(form,false);
if ($.cookie('btrfs-balance-<?=$disk['name']?>')) btrfsBalance($.cookie('btrfs-balance-<?=$disk['name']?>'));
if ($.cookie('btrfs-scrub-<?=$disk['name']?>')) btrfsScrub($.cookie('btrfs-scrub-<?=$disk['name']?>'));
if ($.cookie('btrfs-check-<?=$disk['name']?>')) btrfsCheck($.cookie('btrfs-check-<?=$disk['name']?>'));
if ($.cookie('rfs-check-<?=$disk['name']?>')) rfsCheck($.cookie('rfs-check-<?=$disk['name']?>'));
if ($.cookie('xfs-check-<?=$disk['name']?>')) xfsCheck($.cookie('xfs-check-<?=$disk['name']?>'));
});
</script>
@@ -278,7 +345,7 @@ Critical disk utilization threshold (%):
<?if (strpos($disk['fsType'],"btrfs")!==false):?>
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-balance-scale"></i>Balance Status</span></div>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'btrfs-balance-<?=$disk['name']?>','/mnt/<?=$disk['name']?>')">
<?if ($disk['fsStatus']=="Mounted"):?>
<?exec("$docroot/webGui/scripts/btrfs_balance status /mnt/{$disk['name']}", $balance_status, $retval);?>
@@ -286,15 +353,29 @@ btrfs filesystem df:
: <?echo "<pre>".shell_exec("/sbin/btrfs filesystem df /mnt/{$disk['name']}")."</pre>";?>
btrfs balance status:
: <?echo "<pre>" . implode("\n", $balance_status) . "</pre>";?>
: <?echo "<pre id='btrfs-balance'>".implode("\n", $balance_status)."</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_balance">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
<input type="hidden" name="#arg[3]" value="">
&nbsp;
: <input type="submit" value="Balance"><input type="text" name="#arg[3]" maxlength="256" value=""> Options (see Help)
: <input type="submit" value="Balance">
<?if ($var['SYS_CACHE_SLOTS']>1):?>
<select name="dconvert" onchange="updateMode(this.form,this.value)">
<?=mk_option(1,'','Perform full balance');?>
<?=mk_option(1,'-dconvert=single -mconvert=raid1','Convert to single mode');?>
<?=mk_option(1,'-dconvert=raid0 -mconvert=raid1','Convert to raid0 mode');?>
<?=mk_option(1,'-dconvert=raid1 -mconvert=raid1','Convert to raid1 mode');?>
<?if ($var['SYS_CACHE_SLOTS']>=4) echo mk_option(1,'-dconvert=raid10 -mconvert=raid10','Convert to raid10 mode');?>
<?if ($var['SYS_CACHE_SLOTS']>=3) echo mk_option(1,'-dconvert=raid5 -mconvert=raid1','Convert to raid5 mode');?>
<?if ($var['SYS_CACHE_SLOTS']>=4) echo mk_option(1,'-dconvert=raid6 -mconvert=raid1','Convert to raid6 mode');?>
</select><span id="mode-warning" class="red-text"></span>
<?else:?>
*Perform full balance*
<?endif;?>
> **Balance** will run the *btrfs balance* program to restripe the extents across all pool devices, for example,
> to convert the pool from raid1 to raid0 or vice-versa.
@@ -314,7 +395,7 @@ btrfs balance status:
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
: <input type="submit" value="Cancel">
> **Cancel** will cancel the balance operation in progress.
@@ -329,12 +410,12 @@ btrfs balance status:
<?endif;?>
<?if (strpos($disk['fsType'],"btrfs")!==false):?>
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-paint-brush"></i>Scrub Status</span></div>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'btrfs-scrub-<?=$disk['name']?>','/mnt/<?=$disk['name']?>')">
<?if ($disk['fsStatus']=="Mounted"):?>
<?exec("$docroot/webGui/scripts/btrfs_scrub status /mnt/{$disk['name']}", $scrub_status, $retval);?>
btrfs scrub status:
: <?echo "<pre>" . implode("\n", $scrub_status) . "</pre>";?>
: <?echo "<pre id='btrfs-scrub'>".implode("\n", $scrub_status)."</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_scrub">
@@ -356,7 +437,7 @@ btrfs scrub status:
<input type="hidden" name="#arg[2]" value="/mnt/<?=$disk['name']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
: <input type="submit" value="Cancel">
> **Cancel** will cancel the Scrub operation in progress.
@@ -371,21 +452,21 @@ btrfs scrub status:
<?endif?>
<?if (strpos($disk['fsType'],"btrfs")!==false):?>
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'btrfs-check-<?=$disk['name']?>','/dev/<?=$disk['deviceSb']?> <?=$disk['id']?>')">
<?if (maintenance_mode()):?>
<?exec("$docroot/webGui/scripts/btrfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
btrfs check status:
: <?echo "<pre>" . implode("\n", $check_status) . "</pre>";?>
: <?echo "<pre id='btrfs-check'>".implode("\n", $check_status)."</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_check">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="submit" value="Check"><input type="text" name="#arg[4]" maxlength="256" value="--readonly"> Options (see Help)
: <input type="submit" value="Check"><input type="text" name="#arg[4]" class="narrow" maxlength="256" value="--readonly"> Options (see Help)
> **Check** will run the *btrfs check* program to check file system integrity on the device.
>
@@ -399,12 +480,12 @@ btrfs check status:
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/btrfs_check">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
: <input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Check operation in progress.
@@ -425,21 +506,21 @@ btrfs check status:
<?endif;?>
<?if (strpos($disk['fsType'],"reiserfs")!==false):?>
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'rfs-check-<?=$disk['name']?>','/dev/<?=$disk['deviceSb']?> <?=$disk['id']?>')">
<?if (maintenance_mode()):?>
<?exec("$docroot/webGui/scripts/reiserfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
reiserfsck status:
: <?echo "<pre>" . implode("\n", $check_status) . "</pre>";?>
: <?echo "<pre id='rfs-check'>".implode("\n", $check_status)."</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/reiserfs_check">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="submit" value="Check"><input type="text" name="#arg[4]" maxlength="256" value=""> Options (see Help)
: <input type="submit" value="Check"><input type="text" name="#arg[4]" class="narrow" maxlength="256" value=""> Options (see Help)
> **Check** will run the *reiserfsck* program to check file system integrity on the device.
>
@@ -454,12 +535,12 @@ reiserfsck status:
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/reiserfs_check">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
: <input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Check operation in progress.
@@ -474,21 +555,21 @@ reiserfsck status:
<?endif;?>
<?if (strpos($disk['fsType'],"xfs")!==false):?>
<div id="title" class="nocontrol"><span class="left"><i class="title fa fa-shield"></i>Check Filesystem Status</span></div>
<form markdown="1" method="POST" action="/update.php" target="progressFrame">
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'xfs-check-<?=$disk['name']?>','/dev/<?=$disk['deviceSb']?> <?=$disk['id']?>')">
<?if (maintenance_mode()):?>
<?exec("$docroot/webGui/scripts/xfs_check status /dev/{$disk['deviceSb']} {$disk['id']}", $check_status, $retval);?>
xfs_repair status:
: <?echo "<pre>" . implode("\n", $check_status) . "</pre>";?>
: <?echo "<pre id='xfs-check'>".implode("\n", $check_status)."</pre>";?>
<?if ($retval != 0):?>
<input type="hidden" name="#command" value="/webGui/scripts/xfs_check">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
<input type="hidden" name="#arg[1]" value="start">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[3]" value="<?=$disk['id']?>">
&nbsp;
: <input type="submit" value="Check"><input type="text" name="#arg[4]" maxlength="256" value="-n"> Options (see Help)
: <input type="submit" value="Check"><input type="text" name="#arg[4]" class="narrow" maxlength="256" value="-n"> Options (see Help)
> **Check** will run the *xfs_repair* program to check file system integrity on the device.
>
@@ -502,11 +583,11 @@ xfs_repair status:
<?else:?>
<input type="hidden" name="#command" value="/webGui/scripts/xfs_check">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
<input type="hidden" name="#arg[1]" value="cancel">
<input type="hidden" name="#arg[2]" value="/dev/<?=$disk['deviceSb']?>">
&nbsp;
: <input type="button" value="Refresh" onclick="refresh()"><input type="submit" value="Cancel"> *Running*
: <input type="submit" value="Cancel"> *Running*
> **Cancel** will cancel the Check operation in progress.
+56 -12
View File
@@ -3,8 +3,8 @@ Title="Add User"
Tag="user"
---
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -18,31 +18,43 @@ Tag="user"
<?
$void = "<img src='/webGui/images/user.png' width='48' height='48' onclick='$(&quot;#drop&quot;).click()' style='cursor:pointer' title='Click to select PNG file'>";
$icon = "<i class='fa fa-trash top' title='Restore default image' onclick='restore()'></i>";
$zxcvbn = file_exists('/boot/config/plugins/dynamix/zxcvbn.js');
?>
<style>
<?if ($display['theme']=='gray'):?>
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#121510;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#121510;padding:28px 12px;line-height:72px;margin-right:16px}
<?elseif ($display['theme']=='azure'):?>
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#EDEAEF;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#EDEAEF;padding:28px 12px;line-height:72px;margin-right:16px}
<?elseif ($display['theme']=='black'):?>
span#dropbox{border:1px solid #f2f2f2;border-radius:5px;background:#262626;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #f2f2f2;border-radius:5px;background:#262626;padding:28px 12px;line-height:72px;margin-right:16px}
<?else:?>
span#dropbox{border:1px solid #1c1c1c;border-radius:5px;background:#e8e8e8;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #1c1c1c;border-radius:5px;background:#e8e8e8;padding:28px 12px;line-height:72px;margin-right:16px}
<?endif;?>
i.top{position:absolute;padding-top:4px;cursor:pointer;}
i.top{position:absolute;padding-top:4px;cursor:pointer}
i#showPass.checked{opacity:0.5}
.usage-disk.sys{display:inline-block;width:10rem;top:<?=$themes2?'1.2':'.7'?>rem;margin-left:12px;border-radius:4px}
</style>
<script src="<?autov('/webGui/javascript/jquery.filedrop.js')?>"></script>
<script src="<?autov('/webGui/javascript/jquery.base64.js')?>"></script>
<?if ($zxcvbn):?>
<script src="<?autov('/boot/config/plugins/dynamix/zxcvbn.js')?>" async></script>
<?endif;?>
<script>
var path = '/boot/config/plugins/dynamix/users';
var filename = '';
function restore() {
// restore original image
$('#dropbox').html("<?=$void?>");
filename = '';
function showPassword() {
if ($('#showPass').hasClass('checked')) {
$('#showPass').removeClass('checked');
var type = 'password';
} else {
$('#showPass').addClass('checked');
var type = 'text';
}
$('input[name="userPasswordGUI"]').attr('type',type);
$('input[name="userPasswordConfGUI"]').attr('type',type);
}
function checkUsername(form) {
@@ -69,6 +81,37 @@ function checkUsername(form) {
return true;
}
function validatePassword(input) {
<?if ($zxcvbn):?>
var custom = ['unraid','limetech','lime-technology','bergware','squidly'];
var strength = ['Worst','Bad','Weak','Good','Strong'];
var emoji = ['&#128565;','&#128553;','&#128532;','&#128512;','&#128526;'];
if (!input) {
$('#strength-bar').css('background-color','transparent');
$('#strength-text').html('');
$('.usage-disk.sys').addClass('none');
} else {
var bar = zxcvbn(input,custom);
switch (bar.score) {
case 0: $('#strength-bar').css('background-color','red'); break;
case 1: $('#strength-bar').css('background-color','yellow'); break;
case 2: $('#strength-bar').css('background-color','orange'); break;
case 3: $('#strength-bar').css('background-color','blue'); break;
case 4: $('#strength-bar').css('background-color','green'); break;
}
$('#strength-bar').css('width',Math.min(input.length*100/64,100)+'%');
$('#strength-text').html(emoji[bar.score]+' '+strength[bar.score]+'. '+bar.feedback.warning);
$('.usage-disk.sys').removeClass('none');
}
<?endif;?>
}
function restore() {
// restore original image
$('#dropbox').html("<?=$void?>");
filename = '';
}
$(function(){
var dropbox = $('#dropbox');
// attach the drag-n-drop feature to the 'dropbox' element
@@ -141,7 +184,8 @@ Custom image:
Password:
<input type="hidden" name="userPassword" value="">
: <input type="password" name="userPasswordGUI" maxlength="129" onKeyUp="this.form.cmdUserEdit.disabled=(this.form.userName.value=='' || this.form.userPasswordGUI.value!=this.form.userPasswordConfGUI.value)">
: <input type="password" name="userPasswordGUI" maxlength="129" onKeyUp="validatePassword(this.value);this.form.cmdUserEdit.disabled=(this.form.userName.value=='' || this.form.userPasswordGUI.value!=this.form.userPasswordConfGUI.value)">
<i id="showPass" class="fa fa-eye" style="cursor:pointer" title="Show / Hide password" onclick="showPassword()"></i><span><span class="usage-disk sys none"><span id="strength-bar" style="width:0"></span><span></span></span><span id="strength-text"></span></span>
> Up to 128 characters.
+50 -6
View File
@@ -25,27 +25,45 @@ Tag="user"
$user = "/boot/config/plugins/dynamix/users/$name.png";
$void = "<img src='/webGui/images/user.png' width='48' height='48' id='image' onclick='$(&quot;#drop&quot;).click()' style='cursor:pointer' title='Click to select PNG file'>";
$icon = "<i class='fa fa-trash top' title='Restore default image' onclick='restore()'></i>";
$zxcvbn = file_exists('/boot/config/plugins/dynamix/zxcvbn.js');
?>
<style>
<?if ($display['theme']=='gray'):?>
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#121510;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#121510;padding:28px 12px;line-height:72px;margin-right:16px}
<?elseif ($display['theme']=='azure'):?>
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#EDEAEF;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #606E7F;border-radius:5px;background:#EDEAEF;padding:28px 12px;line-height:72px;margin-right:16px}
<?elseif ($display['theme']=='black'):?>
span#dropbox{border:1px solid #f2f2f2;border-radius:5px;background:#262626;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #f2f2f2;border-radius:5px;background:#262626;padding:28px 12px;line-height:72px;margin-right:16px}
<?else:?>
span#dropbox{border:1px solid #1c1c1c;border-radius:5px;background:#e8e8e8;padding:28px 12px;line-height:72px;margin-right:16px;}
span#dropbox{border:1px solid #1c1c1c;border-radius:5px;background:#e8e8e8;padding:28px 12px;line-height:72px;margin-right:16px}
<?endif;?>
i.top{position:absolute;padding-top:4px;cursor:pointer;}
i.top{position:absolute;padding-top:4px;cursor:pointer}
i#showPass.checked{opacity:0.5}
.usage-disk.sys{display:inline-block;width:10rem;top:<?=$themes2?'1.2':'.7'?>rem;margin-left:12px;border-radius:4px}
</style>
<script src="<?autov('/webGui/javascript/jquery.filedrop.js')?>"></script>
<script src="<?autov('/webGui/javascript/jquery.base64.js')?>"></script>
<?if ($zxcvbn):?>
<script src="<?autov('/boot/config/plugins/dynamix/zxcvbn.js')?>" async></script>
<?endif;?>
<script>
var path = '/boot/config/plugins/dynamix/users';
var filename = '';
function showPassword() {
if ($('#showPass').hasClass('checked')) {
$('#showPass').removeClass('checked');
var type = 'password';
} else {
$('#showPass').addClass('checked');
var type = 'text';
}
$('input[name="userPasswordGUI"]').attr('type',type);
$('input[name="userPasswordConfGUI"]').attr('type',type);
}
function checkPassword(form) {
if (form.userPasswordGUI.value.length > 128 || form.userPasswordConfGUI.value.length > 128) {
swal({title:"Password too long",text:"Use a password up to 128 characters",type:"error"});
@@ -58,6 +76,31 @@ function checkPassword(form) {
return true;
}
function validatePassword(input) {
<?if ($zxcvbn):?>
var custom = ['unraid','limetech','lime-technology','bergware','squidly'];
var strength = ['Worst','Bad','Weak','Good','Strong'];
var emoji = ['&#128565;','&#128553;','&#128532;','&#128512;','&#128526;'];
if (!input) {
$('#strength-bar').css('background-color','transparent');
$('#strength-text').html('');
$('.usage-disk.sys').addClass('none');
} else {
var bar = zxcvbn(input,custom);
switch (bar.score) {
case 0: $('#strength-bar').css('background-color','red'); break;
case 1: $('#strength-bar').css('background-color','yellow'); break;
case 2: $('#strength-bar').css('background-color','orange'); break;
case 3: $('#strength-bar').css('background-color','blue'); break;
case 4: $('#strength-bar').css('background-color','green'); break;
}
$('#strength-bar').css('width',Math.min(input.length*100/64,100)+'%');
$('#strength-text').html(emoji[bar.score]+' '+strength[bar.score]+'. '+bar.feedback.warning);
$('.usage-disk.sys').removeClass('none');
}
<?endif;?>
}
function restore() {
// restore original image and activate APPLY button
$('#dropbox').html("<?=$void?>");
@@ -160,7 +203,8 @@ Delete<input type="checkbox" name="confirmDelete" onChange="chkDelete(this.form,
<input type="hidden" name="userName" value="<?=htmlspecialchars($name)?>">
Password:
<input type="hidden" name="userPassword" value="">
: <input type="password" name="userPasswordGUI" maxlength="129" onKeyUp="this.form.cmdUserEdit.disabled=(this.form.userPasswordGUI.value != this.form.userPasswordConfGUI.value);">
: <input type="password" name="userPasswordGUI" maxlength="129" onKeyUp="validatePassword(this.value);this.form.cmdUserEdit.disabled=(this.form.userPasswordGUI.value != this.form.userPasswordConfGUI.value);">
<i id="showPass" class="fa fa-eye" style="cursor:pointer" title="Show / Hide password" onclick="showPassword()"></i><span><span class="usage-disk sys none"><span id="strength-bar" style="width:0"></span><span></span></span><span id="strength-text"></span></span>
> Up to 128 characters.
@@ -0,0 +1,38 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$cmd = $_POST['cmd'];
$path = $_POST['path'];
switch ($cmd) {
case 'balance':
case 'scrub':
echo shell_exec("/sbin/btrfs $cmd status $path");
break;
default:
[$dev,$id] = explode(' ',$path);
$file = "/var/lib/$cmd/check.status.$id";
if (file_exists($file)) {
switch ($cmd) {
case 'btrfs': $pgrep = "pgrep -f '/sbin/btrfs check .*$dev'"; break;
case 'rfs': $pgrep = "pgrep -f '/sbin/reiserfsck $dev'"; break;
case 'xfs': $pgrep = "pgrep -f '/sbin/xfs_repair.*$dev'"; break;
}
echo file_get_contents($file);
if (!exec($pgrep)) echo "\0";
} else {
echo "Not available\0";
}
break;
}
?>
+1 -1
View File
@@ -54,7 +54,7 @@ function addLog(logLine) {
}
function disablePage() {
top.document.getElementsByClassName('spinner fixed')[0].style.display = 'block';
setTimeout(function(){top.document.getElementsByClassName('spinner fixed')[0].style.display = 'block';},150); // show spinner when operation takes longer than 150ms
for (var i=0,element; element=top.document.querySelectorAll('input,button,select')[i]; i++) element.disabled = true;
for (var i=0,link; link=top.document.getElementsByTagName('a')[i]; i++) link.style.color = "gray"; //fake disable
}