mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-28 07:10:21 +00:00
adding user record
This commit is contained in:
parent
b34c712c38
commit
532cfdad2e
1 changed files with 3 additions and 1 deletions
4
app.js
4
app.js
|
@ -300,13 +300,15 @@ async function get_app_server() {
|
||||||
client.setCredentials(tokens);
|
client.setCredentials(tokens);
|
||||||
const oauth2 = google.oauth2({version: 'v2', auth: client});
|
const oauth2 = google.oauth2({version: 'v2', auth: client});
|
||||||
const googleUserProfile = await oauth2.userinfo.v2.me.get();
|
const googleUserProfile = await oauth2.userinfo.v2.me.get();
|
||||||
console.log(JSON.stringify(googleUserProfile))
|
|
||||||
const email = googleUserProfile.data.email
|
const email = googleUserProfile.data.email
|
||||||
const [user, created] = await Users.findOrCreate({ where: { 'email': email } });
|
const [user, created] = await Users.findOrCreate({ where: { 'email': email } });
|
||||||
if(created){
|
if(created){
|
||||||
user.path = makeRandomPath(20);
|
user.path = makeRandomPath(20);
|
||||||
user.save();
|
user.save();
|
||||||
}
|
}
|
||||||
|
console.log(req.session);
|
||||||
|
console.log(user);
|
||||||
|
console.log("POTATO");
|
||||||
req.session.email = user.email;
|
req.session.email = user.email;
|
||||||
req.session.authenticated = true;
|
req.session.authenticated = true;
|
||||||
res.send(`Hello ${user.email}, your path is ${user.path}!`);
|
res.send(`Hello ${user.email}, your path is ${user.path}!`);
|
||||||
|
|
Loading…
Reference in a new issue