Current File : //etc/zpanel/panel/modules/ftp_management/module.zpm |
<div class="zmodule_content panel" id="zmodule_header_<@ ModuleName @>">
<div class="panel-heading">
<img src="<@ ModuleIcon @>" width="35" height="35" border="0" alt="<@ ModuleName @>">
<div class="zmodule_title">
<@ ModuleName @>
</div>
<div class="zmodule_desc" id="zmodule_desc_<@ ModuleName @>"><@ ModuleDesc @></div>
</div>
<style>
.helpicon {
display: block;
float: right;
border: 1px solid #ccc;
background-color: #f3f3f3;
padding: 5px 10px;
font-size: 12px;
margin-top:-121px;
margin-right:5px;
-webkit-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-webkit-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
}
</style>
<div class="helpicon">
<a href="<@ helpicon @>" target="_blank"><img src="etc/styles/CstyleX-master/images/help.png" style="float:left;" ><span style="float:left;margin-top:8px;font-weight:bold;font-size:12px;" >Video Tutorial</span></a>
</div>
<@ Result @>
<% if isDeleteFTP %>
<div class="zform_wrapper alert alert-danger">
<h2><: Delete FTP account :>: <@ EditCurrentName @> ?</h2>
<p><: Please confirm that you want to delete this FTP account. :></p>
<form action="./?module=ftp_management&action=DeleteFTP" method="post">
<table class="none" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="right">
<input type="hidden" name="inDelete" value="<@ EditCurrentID @>">
<button class="button-loader delete btn btn-danger" type="submit" ><: Delete :></button>
<button class="button-loader btn btn-default" type="button" onclick="window.location.href='./?module=ftp_management';return false;"><: Cancel :></button>
</td>
</tr>
</table>
<@ CSFR_Tag @>
</form>
</div>
<% endif %>
<% if isEditFTP %>
<div class="zform_wrapper">
<h2><: Reset FTP Password for user :>: <@ EditCurrentName @></h2>
<form id="edit_ftp" action="./?module=ftp_management&action=ResetPassword" method="post">
<table class="table table-striped">
<tr>
<th><: Username :>:</th>
<td><@ EditCurrentName @></td>
<td></td>
</tr>
<tr>
<th><: New password :>:</th>
<td><input name="inPassword" type="text" id="inPassword" size="30" maxlength="50" /></td>
<td><button class="button-loader btn btn-default" type="submit" name="inReset" id="button" value="<@ EditCurrentID @>"><: Reset Password :>
</button>
<button class="button-loader btn btn-default" type="button" onclick="window.location.href='./?module=ftp_management';return false;"><: Cancel :></button></td>
</tr>
<tr>
<th></th>
<td><a href="#" class="link-password" id="generate"><@ GeneratePass @></a></td>
<td><span id="result" size="20"></span></td>
<td></td>
</tr>
</table>
<@ CSFR_Tag @>
</form>
<% if currentnote %>
<p><b>Note : </b>Characters needed for password length : 9 with atleast 1 uppercase,lowercase,special character,number.</p>
<% endif %>
</div>
<% endif %>
<div class="zgrid_wrapper">
<h2><: Current FTP accounts :></h2>
<% if ClientList %>
<script type="text/javascript">
var ShowPass = false;
function ShowHide()
{
ShowPass = !ShowPass;
if (ShowPass)
{
document.getElementById('ColPass').style.visibility = 'visible';
document.getElementById('btn_sh').innerHTML = 'Hide passwords';
}
else
{
document.getElementById('ColPass').style.visibility = 'collapse';
document.getElementById('btn_sh').innerHTML = 'Show passwords';
}
return false;
}
</script>
<form action="./?module=ftp_management&action=EditFTP" method="post">
<table class="table table-striped">
<tr>
<th><: Account name :></th>
<th><: Home directory :></th>
<th><: Password :></th>
</tr>
<% loop ClientList %>
<tr>
<td><& username &></td>
<td><& directory &></td>
<td><& password &></td>
<td>
<button class="button-loader btn btn-default" type="submit" name="inReset_<& id &>" id="button" value="inReset_<& id &>"><: Reset Password :></button>
<button class="button-loader delete btn btn-danger" type="submit" name="inDelete_<& id &>" id="button" value="inDelete_<& id &>"><: Delete :></button>
</td>
</tr>
<% endloop %>
</table>
<@ CSFR_Tag @>
</form>
<% else %>
<: You do not have any FTP Accounts setup. Create an FTP account using the form below. :>
<% endif %>
</div>
<% if isCreateFTP %>
<div class="zform_wrapper">
<table class="none" width="100%" cellborder="0" cellspacing="0"><tr valign="top">
<tr valign="top">
<td>
<h2><: Create a new FTP Account :></h2>
<% if QuotaLimit %>
<form id="ftp_mgmt" action="./?module=ftp_management&action=CreateFTP" method="post">
<div>
<div style ="line-height:18px">
<div>
<div nowrap="nowrap" class="lblcls"><: Username :>:</div>
<div class="singlefieldcls">
<input name="inFTPUsername" type="text" id="inFTPUsername" size="55" value="" maxlength="100" onblur="setDirectory()" style="height:32px;width:70%"/>
</div>
</div>
<br />
<div>
<div class="lblcls"><: Password :>:</div>
<div><input name="inPassword" type="text" id="inPassword" size="20" maxlength="50" style="height: 33px;">
<span id="result" size="20"></span>
<a href="#" class="link-password" id="generate"><@ GeneratePass @></a></div>
<input type="hidden" name="inAccess" id="inAccess" value="RW" />
</div>
<br />
<div>
<div id="manual_config_domain" >
<div nowrap="nowrap" class="lblcls"><: Domain :>:</div>
<div class="singlefieldcls">
<select name="inDomain" id="inDomain" style="width:70%;" onchange="setDirectory()">
<% loop DomainList %>
<option value="<& domaindir &>"><& domain &></option>
<% endloop %>
</select>
</div>
</div>
</div>
<br />
<div id="manual_config_dir">
<div class="lblcls"><: Directory :>:</div>
<div><input type="text" id="default_path" name ="default_path" value="<@ UserName @>/public_html" readonly="readonly" style="height: 29px;"/>
<input name="inDir" type="text" id="inDir" size="30" maxlength="50" style="height: 29px;"/></div>
<span id="result"></span>
<input type="hidden" name="inAccess" id="inAccess" value="RW" />
</div>
</div>
<div>
<div class="lblcls" style="width: 100%;"><: Home directory :>:</div>
<div><input name="inAutoHome" type="radio" id="inAutoHome" value="4" onclick="hide_div('showmasterselect')&hide_div('showdomainselect')&showManual();" CHECKED /> <: Manual Config :></div>
</div>
<div>
<div> </div>
<div><input name="inAutoHome" type="radio" id="inAutoHome" value="1" onclick="hide_div('showmasterselect')&hide_div('showdomainselect');" /> <: Create a new home directory :></div>
</div>
<div>
<div> </div>
<div><input name="inAutoHome" type="radio" id="inAutoHome" value="2" onclick="show_div('showmasterselect')&hide_div('showdomainselect');" /> <: Set Master home directory :></div>
</div>
<div>
<div> </div>
<div>
<div id="showmasterselect" style="display:none;">
<select name="inDestination" id="inDestination">
<option value="">/ (root)</option>
<% loop MasterDirsList %>
<option value="<& domains &>">/<& domains &></option>
<% endloop %>
</select>
</div>
</div>
</div>
<div>
<div> </div>
<div><input name="inAutoHome" type="radio" id="inAutoHome" value="3" onclick="show_div('showdomainselect')&hide_div('showmasterselect');" /> <: Use Domain directory :></div>
</div>
<div>
<div> </div>
<div>
<div id="showdomainselect" style="display:none;">
<select name="inDomainDestination" id="inDomainDestination">
<option value="">/ (root)</option>
<% loop DomainDirsList %>
<option value="public_html/<& domains &>">/<& domains &></option>
<% endloop %>
</select>
</div>
</div>
</div>
<div>
<div colspan="2" align="right">
<button class="button-loader btn btn-primary" type="submit" name="inSubmit" id="inSubmit" value=""><: Create :></button></div>
</div>
</div>
<@ CSFR_Tag @>
</form>
<% if currentnote %>
<p><b>Note : </b>Characters needed for password length : 9 with atleast 1 uppercase,lowercase,special character,number.</p>
<% endif %>
<% else %>
<: You have reached your FTP account limit! :>
<% endif %>
</td>
<!--td align="right"><@ FTPUsagepChart @></td-->
</tr>
</table>
</div>
<% endif %>
<div class="zgrid_wrapper">
<% if SpecialFtpAccount %>
<h2><: Special FTP Account :></h2>
<table class="table table-striped">
<tr>
<th><: Account name :></th>
<th><: Type :></th>
</tr>
<tr>
<td><@ SpecialFtpAccount @></td>
<td><: Special FTP Account :></td>
</tr>
</table>
<% endif %>
</div>
</div>
<script type="text/javascript">
<!--
function show_div(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
}
//-->
</script>
<script type="text/javascript">
<!--
function hide_div(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
var x = document.getElementById('manual_config_domain');
x.style.display = 'none';
var x = document.getElementById('manual_config_dir');
x.style.display = 'none';
}
function showManual() {
var x = document.getElementById('manual_config_domain');
x.style.display = 'block';
var x = document.getElementById('manual_config_dir');
x.style.display = 'block';
}
//-->
</script>
<script type="text/JavaScript">
$.extend({
password: function (length, special) {
var iteration = 0;
var password = "";
var specials = '!@#$&*';
var lowercase = 'abcdefghijklmnopqrstuvwxyz';
var uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var numbers = '0123456789';
var all = specials + lowercase + uppercase + numbers;
String.prototype.pick = function(min, max) {
var n, chars = '';
if (typeof max === 'undefined') {
n = min;
} else {
n = min + Math.floor(Math.random() * (max - min));
}
for (var i = 0; i < n; i++) {
chars += this.charAt(Math.floor(Math.random() * this.length));
}
return chars;
};
// Credit to @Christoph: http://stackoverflow.com/a/962890/464744
String.prototype.shuffle = function() {
var array = this.split('');
var tmp, current, top = array.length;
if (top) while (--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = array[current];
array[current] = array[top];
array[top] = tmp;
}
return array.join('');
};
var password = (specials.pick(1) + lowercase.pick(1) + uppercase.pick(1) + numbers.pick(1) + all.pick(5)).shuffle();
return password;
}
});
/*$(document).ready(function() {
$('.link-password').click(function(e){
linkId = $(this).attr('id');
if (linkId == 'generate'){
password = $.password(9,false);
$('#inPassword').val(password);
}
e.preventDefault();
});
});*/
$(document).ready(function()
{
/*
assigning keyup event to password field
so everytime user type code will execute
*/
$('.link-password').click(function(e){
linkId = $(this).attr('id');
if (linkId == 'generate'){
password = $.password(9,false);
$('#inPassword').val(password);
$('#result').html(checkStrength($('#inPassword').val()));
}
e.preventDefault();
});
if($('#inPassword').val().length ==0){
$('#inCreate').attr('disabled', 'disabled');
}
$('#inPassword').keyup(function()
{
$('#result').html(checkStrength($('#inPassword').val()))
})
/*
checkStrength is function which will do the
main password strength checking for us
*/
function checkStrength(password)
{
//initial strength
var strength = 0
//if the password length is less than 6, return message.
if (password.length < 6) {
$('#result').removeClass();
$('#result').addClass('short');
$('#inCreate').attr('disabled','disabled');
return 'Too short';
}
//length is ok, lets continue.
//if length is 8 characters or more, increase strength value
if (password.length > 7) strength += 1
//if password contains both lower and uppercase characters, increase strength value
if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) strength += 1
//if it has numbers and characters, increase strength value
if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) strength += 1
//if it has one special character, increase strength value
if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
//if it has two special characters, increase strength value
if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
//now we have calculated strength value, we can return messages
//if value is less than 2
if (strength <2 )
{
$('#result').removeClass();
$('#result').addClass('weak');
$('#inCreate').attr('disabled','disabled');
return 'Weak'
}
else if (strength == 2 )
{
$('#result').removeClass();
$('#result').addClass('good');
// $("#inCreate").show();
$('#inCreate').removeAttr('disabled');
return 'Good'
}
else
{
$('#result').removeClass();
$('#result').addClass('strong');
// $("#inCreate").show();
$('#inCreate').removeAttr('disabled');
return 'Strong'
}
}
});
function setDirectory() {
var domain = document.getElementById('inDomain').value;
var username = document.getElementById('inFTPUsername').value;
if(domain=='/') {
domain='';
}
document.getElementById('inDir').value = domain+"/"+username;
}
function hideShowManual() {
var x = document.getElementById("manual_config");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
<style>
#edit_ftp .short,#ftp_mgmt .short{
font-weight:bold;
color:#FF0000;
font-size:larger;
}
#edit_ftp .weak, #ftp_mgmt .weak{
font-weight:bold;
color:orange;
font-size:larger;
}
#edit_ftp .good, #ftp_mgmt .good{
font-weight:bold;
color:#2D98F3;
font-size:larger;
}
#edit_ftp .strong, #ftp_mgmt .strong{
font-weight:bold;
color: limegreen;
font-size:larger;
}
#default_path {
border-radius: 0px;
border: 1px solid #ccc;
background-color: #e6e6e6;
line-height: 28px;
white-space: nowrap;
text-align: center;
}
#inDir {
margin-left: -6px;
line-height: 24px;
width: 48%;
border: 2px solid #dadada;
color: #000;
}
.lblcls {
font-weight: bold;
width: 20%;
float: left;
}
</style>