Hi there, i wanted to make a login and register screen where the data is stored on google sheets. I followed a tutorial but I have a problem. I can Login only if the password contains only numbers. I want it to be able to contain etters as well. I cant find where that restriction is… Please help
I will attach the google sheets code and the blocks
- List item
function doGet(e) {
return Authentication(e);
}
function doPost(e) {
return Authentication(e);
}
function Authentication(e) {
if (e.parameter.func == “Create”) {
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheetByName(e.parameter.SH);
var rg = sh.getName() + “!” + sh.getDataRange().getA1Notation();
var username = e.parameter.username;
var sql = ‘"Select B where B=’’+username+’’"’;
var qry = ‘=IFERROR(query(’ + rg + ‘,’ + sql + ‘),"")’;
var ts = ss.insertSheet();
var setQuery = ts.getRange(1,1).setFormula(qry);
var getResult = ts.getDataRange().getValues();
ss.deleteSheet(ts);
if (getResult==""){
var data =[e.parameter.name, e.parameter.username, e.parameter.password];
sh.appendRow(data);
return ContentService.createTextOutput(getResult);}
}
//------------------------------------------------------
if (e.parameter.func == “Login”) {
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheetByName(e.parameter.SH);
var username = e.parameter.username;
var password = e.parameter.password;
var rg = sh.getName() + “!” + sh.getDataRange().getA1Notation();
var sql = ‘"Select A,B,C where B=’’+username+’’"’;
var qry = ‘=IFERROR(query(’ + rg + ‘,’ + sql + ‘),"")’;
var ts = ss.insertSheet();
var setQuery = ts.getRange(1,1).setFormula(qry);
var getResult = ts.getDataRange().getValues();
var getPWD = ts.getRange(1,3).getValues();
var getFullName = ts.getRange(1,1).getValues();
ss.deleteSheet(ts);
if (getResult!=""){
if (getPWD==password){return ContentService.createTextOutput(getFullName);}
else { return ContentService.createTextOutput("ERPWD");}
}
else{return ContentService.createTextOutput(getResult);}
}
}
blocks: