Skip to content

Commit 79a2198

Browse files
authored
Merge pull request #33 from vanpariyar/master
Reverse Merge
2 parents 04b906d + bdb2f97 commit 79a2198

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
patreon: vanpariyar
4+
custom: ['https://www.buymeacoffee.com/vanpariyar']

Appscript.gs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ function doPost(e){
4343
return signup(book, e);
4444
break;
4545

46+
case 'googleSignin':
47+
return googleSignin(book, e);
48+
break;
49+
4650
case 'result':
4751
return result(book, e);
4852
break;
@@ -130,6 +134,56 @@ function signup(book, e){
130134

131135
}
132136

137+
/**
138+
* Handle Google SignIN
139+
*/
140+
function googleSignin(book, e){
141+
var sheetName = "users";
142+
var sheet = book.getSheetByName(sheetName);
143+
var idFlag = 0;
144+
var emailFlag = 0;
145+
var lr= sheet.getLastRow();
146+
var userEmail = [];
147+
var userPass = [];
148+
var token = '';
149+
for(var i=1;i<=lr;i++){
150+
if(sheet.getRange(i, 3).getValue()==e.parameter.email){
151+
emailFlag = 1;
152+
}
153+
if(sheet.getRange(i, 4).getValue()==e.parameter.id){
154+
idFlag = 1;
155+
}
156+
idFlag && emailFlag && (token = sheet.getRange(i, 4).getValue());
157+
}
158+
159+
160+
if(idFlag && emailFlag){
161+
result = 'Login success...';
162+
163+
}else if(!idFlag && emailFlag){
164+
result = 'Wrong Password...';
165+
}else{
166+
var d = new Date();
167+
var currentTime = d.toLocaleString();
168+
var token = Utilities.base64Encode(e.parameter.email);
169+
var rowData = sheet.appendRow([currentTime,e.parameter.name, e.parameter.email, e.parameter.id, token]);
170+
result = 'Signup Success ....';
171+
}
172+
173+
makeLog(`user activity in login ${ (idFlag && emailFlag) ? 'sucess' : 'Failed' } Email: ${e.parameter.email} , User: ${e.parameter.name}`);
174+
var token = Utilities.base64Encode(e.parameter.email);
175+
result = JSON.stringify({
176+
"result": result,
177+
"login" : (idFlag && emailFlag) ? 1 : 0,
178+
"token" : token,
179+
});
180+
return ContentService
181+
.createTextOutput(result)
182+
.setMimeType(ContentService.MimeType.JSON);
183+
184+
}
185+
186+
133187
function demo(book, e){
134188
var sheetName = "users";
135189
var book = SpreadsheetApp.getActiveSpreadsheet();

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
11
# quiz-from-sheets
22
we are developing the quiz which fetches the questions from the google sheets and it will store the answers of users in the sheet
3+
4+
## Features:
5+
6+
1. Generates quiz directly from the Google shhets.
7+
2. you can use this login signup functionality to extend your Project.
8+
3. this is opensource You can also contribute.
9+
10+
### Demo URL :point_right: -> https://vanpariyar.github.io/quiz-from-sheets :octocat:
11+
12+
see Sheets -> https://docs.google.com/spreadsheets/d/1hioz7VjnRoF47XBgL1ZyocTFqnEgqzVHNcjmVd2vE68/
13+
14+
To use this application you can clone and download this repo.
15+
16+
## Tutorial
17+
18+
#### Step :one:
19+
20+
Click to copy this link: :point_down:
21+
322
https://docs.google.com/spreadsheets/d/1hioz7VjnRoF47XBgL1ZyocTFqnEgqzVHNcjmVd2vE68/copy
23+
24+
#### Step :two:
25+
26+
### After copy
27+
Enter your google Creds. It will store in your Drive. Don't worry not spam :joy:
28+
29+
![contact form to sheets](https://user-images.githubusercontent.com/26689210/77770067-b1336080-706a-11ea-8624-7b7be4ce8e81.png)
30+
31+
THEN
32+
33+
![contact form to sheets](https://user-images.githubusercontent.com/26689210/77770070-b2fd2400-706a-11ea-9537-990b6bb9caa0.png)
34+
35+
### IN Google Sheet
36+
Goto Tools > ScriptEditor.
37+
38+
![Screenshot from 2020-03-27 20-31-02](https://user-images.githubusercontent.com/26689210/77770956-0de34b00-706c-11ea-8e7f-1e3633c8f03c.png)
39+
40+
### In the Newly opened window
41+
Change as per your requirement.
42+
Publish > Deploy As app.
43+
![Screenshot from 2020-03-27 20-31-55](https://user-images.githubusercontent.com/26689210/77770978-176cb300-706c-11ea-8532-fd209743a761.png)
44+
45+
### In Newly opened window
46+
Set settings as shown.
47+
- Anonymous is required.
48+
- Run as me required to use on your website.
49+
50+
Copy This retrived URL.
51+
52+
Please, Do same settings.
53+
54+
![Screenshot from 2020-04-10 10-34-57](https://user-images.githubusercontent.com/26689210/78964233-2432e180-7b17-11ea-88b7-bd31d29db995.png)
55+
56+
publish the script as a web app.
57+
58+
### NOTE: IF it is asking for the authorization goto advance > then continue to unsafe Then copy SCRIPT Url:
59+
:sweat_smile: Not any harm full code but Google does not allow any code without your confirmation.
60+
You can review my code if you feel uncomfortable it's fine.
61+
62+
Now where to put this URL :thinking:
63+
64+
The answer is put in ` in three Folders` login , signup , result.
65+
66+
We are try to solving this issue hope it may be solve.
67+
68+
69+
if you have in trouble send :sos: message to us and Take some :shower: (Shower) We'll try to help.

0 commit comments

Comments
 (0)