以下html和相关功能今天停止工作。
<style>
#header {
height:100px;
background:Green;
font-size:300%;
color: Black;
align-content: centre;
}
body {
width:60%;
margin-left:auto;
margin-right:auto;
margin-top:10%;
font-size:16pt;
font-family:Verdana;
padding: 100px;
}
#content{
float:centre;
height: 500px;
width: 500px;
top:200px;
left:200px;
}
input[type=password]{
height: 44px;
font-size: 16px;
width: 268px;
margin-bottom: 10px;
margin-top: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.animate
{
transition: all 0.1s;
-webkit-transition: all 0.1s;
}
.action-button
{
position: relative;
padding: 10px 40px;
margin: 0px 10px 10px 0px;
float: left;
border-radius: 10px;
font-family: 'Pacifico', cursive;
font-size: 25px;
color: #FFF;
text-decoration: none;
}
.blue
{
background-color: #3498DB;
border-bottom: 5px solid #2980B9;
text-shadow: 0px -2px #2980B9;
}
.red
{
background-color: #E74C3C;
border-bottom: 5px solid #BD3E31;
text-shadow: 0px -2px #BD3E31;
}
.green
{
background-color: #82BF56;
border-bottom: 5px solid #669644;
text-shadow: 0px -2px #669644;
}
.yellow
{
background-color: #F2CF66;
border-bottom: 5px solid #D1B358;
text-shadow: 0px -2px #D1B358;
}
.action-button:active
{
transform: translate(0px,5px);
-webkit-transform: translate(0px,5px);
border-bottom: 1px solid;
}
</style>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script>
function addClients(clients){
$('#customer').empty();
$('#customer').append('<option> ---- Choose a user ----</option>');
for (var i in clients) {
$('#customer').append('<option>'+clients[i]+'</option>');
$('#customer').trigger("chosen:updated");
}
}
function getval(){
var selected_value = $( "#customer option:selected" ).text();
google.script.run.withSuccessHandler(onsuccess).validatepass(selected_value);
}
function onsuccess(retval){
var enteredpass = $("#psw").val();
alert(retval);
if(retval == enteredpass){
$('#content').hide();
$('#formselect').show();
} else
{
alert("Wrong Password");
$("#fmreload").click();
}
}
$('document').ready(function(){
$('#formselect').hide();
google.script.run.withSuccessHandler(addClients).getClients();
});
</script>
</head>
<body>
<div id="content">
<div>
<select name="customer" id="customer" data-native-menu="true" data-role="none">
<option> ---- Choose a user ----</option>
</select>
</div>
<p><input type="password" name="psw" id="psw"><p>
<p><input type="button" value="Submit" onclick="getval()" class="action-button animate blue"></p>
<?var url = getScriptUrl();?><a href='<?=url?>?page=index'> <input type='button' name='formreload' id="fmreload" style="display:none;"></a>
</div>
<div id='formselect'>
<a href='https://script.google.com/a/macros/greenleaf-uae.com/s/AKfycbz_kIsYn4A-3FjeWmQihzFl7rfT73AN1oWu15xDoHHgWGnY29k/exec?page=formselect'>User Forms</a>
</div>
</body>
GAS方面调用的函数是
function validatepass(selected_value){
var usrpass ="this was called";
var doc = SpreadsheetApp.openById(empmaster);
var sheet = doc.getActiveSheet();
var data = sheet.getRange(3, 3, sheet.getLastRow(),6).getValues();// read all data in the sheet
for(var n=0;n<data.length;++n){
var row = data[n][0];
if(row.toString().match(selected_value) == selected_value){
usrpass = data[n][4];
PropertiesService.getScriptProperties().setProperty('curruser', selected_value);
PropertiesService.getScriptProperties().setProperty('currsup', data[n][1]);
PropertiesService.getScriptProperties().setProperty('issup', data[n][5]);
PropertiesService.getScriptProperties().setProperty('usermail', data[n][2]);
PropertiesService.getScriptProperties().setProperty('supmail', data[n][3]);
};
}
return usrpass;
}
这个脚本在今天早上工作正常。
密码只是通过,它应该与返回的值匹配。但是,当我在firefox中检查时,返回的值是
)]}'
[["op.exec",[0,"\"justpass\""]
]
]
这正是我输入的密码。
此致 阿琼