Good day, thank you for this assistance it sure helps a lot. I was wondering if you can assist with Hay Kel's Login & Register script? Assistance will be very much appreciated.
If you share the script here, we can take a look. Or provide a link.
Hi, thanks for the reply. Login & Register with Google Sheet & AI2 | Authenticate with Apps Script on Android - YouTube this is the link to Hay Kel's video tutorial for his login method. I've watched this probably like 50 times and have completely recreated his scripts but it still does not work as shown in his video. I've become so frustrated that I deleted the whole project (with much regret afterwards). I've come to the conclusion that either he did not show a step in the tutorial or something happens in the video that I missed (things do tend to happen rather quickly in the tutorial). I'd really appreciate your input. Thank you.
I have moved this to a new topic.
I reviewed the workflow and the script in the video. I do not see much wrong with it and it should work as shown. I would need to replicate it to find out if there are any errors.
One issue may be about locale in the script - the use of ;
instead of ,
. This depends on the locale you use in sheets and the script.
OK, there were quite a few little things wrong with the script, and the blocks and the script did not match up with what was in the video, but eventually got them to work together I used virtual screens instead of real screens.
Herewith a demo app project. You will need to add your own script url and sheet id.
LARGSGAS_blank.aia (6.9 KB)
and also the google apps script for the web app:
SCRIPT
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 email = e.parameter.email;
var sql = '"Select B where B=\'' + email + '\'"';
var qry = '=IFERROR(query(' + rg + ',' + sql + '),"")';
var ts = ss.insertSheet();
const sheets = SpreadsheetApp.getActive().getSheets();
sheets[sheets.length-1].setName(`Sheet${sheets.length}`);
var setQuery = ts.getRange(1,1).setFormula(qry);
var getResult = ts.getDataRange().getValues();
ss.deleteSheet(ts);
if (getResult == "") {
var data = [e.parameter.fullname, e.parameter.email, e.parameter.password, e.parameter.phone];
sh.appendRow(data);
return ContentService.createTextOutput(getResult);
}
}
if (e.parameter.func == 'Login') {
var msg = '';
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheetByName(e.parameter.SH);
var email = e.parameter.email;
var password = e.parameter.password;
var rg = sh.getName() + "!" + sh.getDataRange().getA1Notation();
var sql = '"Select A,B,C where B=\'' + email + '\'"';
var qry = '=IFERROR(query(' + rg + ',' + sql + '),"")';
var ts = ss.insertSheet();
var setQuery = ts.getRange(1,1).setFormula(qry);
var getName = ts.getRange(1,1).getValue();
var getPWD = ts.getRange(1,3).getValue();
ss.deleteSheet(ts);
if (getName != "") {
if (getPWD != password) {
msg = "ERPWD";
return ContentService.createTextOutput("ERPWD");
}
else {
msg = getName;
}
}
return ContentService.createTextOutput(msg);
}
}
This is done using a google sheet with an en
locale
Also need to give credit where credit is due: Much of the script was originally created by me, in a project long since forgotten / mislaid. HK, used it, but added some of the error checking functionality into the script and the blocks, now we have turned full circle and I have edited what HK has done to make it work !!
Thank you very much for your assistance with this, it is really very much appreciated.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.