From 9dcc5178a6364b7a98959315aff0224b5946a323 Mon Sep 17 00:00:00 2001 From: johanna Date: Mon, 17 Oct 2016 16:21:41 -0400 Subject: [PATCH] Oauthlive (#108) * added form dialog for entering grocery cost * need to work on getting grocery cost data * made grocery cost dialog popup correct hxw and all other dialog cards unaffected * added oauth btns to signup page * oauth switched to live and properly displays name --- browser/js/groceries/groceries_cost.html | 47 +++++++++---------- browser/js/signup/signup.html | 9 ++++ browser/scss/signup/main.scss | 4 ++ .../app/configure/authentication/facebook.js | 12 ++++- server/app/configure/authentication/google.js | 12 ++++- 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/browser/js/groceries/groceries_cost.html b/browser/js/groceries/groceries_cost.html index 47e895a0..ac85b8a8 100644 --- a/browser/js/groceries/groceries_cost.html +++ b/browser/js/groceries/groceries_cost.html @@ -1,28 +1,23 @@ - -
- -
-

Groceries Cost

- - - close - -
-
- - - - - - - - - - Save + + +
+

Add some meals to your grocery list to see your personalized shopping list here!

+
+ + Download this list as a PDF + - - Cancel + + Input grocery Cost + - - - +
+

{{ section }}

+ +

{{item.name}} || {{round(item.amount)}} {{item.unitLong}}

+ +
+
+
+
+
diff --git a/browser/js/signup/signup.html b/browser/js/signup/signup.html index 8d794478..989aa3c9 100644 --- a/browser/js/signup/signup.html +++ b/browser/js/signup/signup.html @@ -42,6 +42,15 @@
Submit +
+

Or, with:

+ + + + + + +
diff --git a/browser/scss/signup/main.scss b/browser/scss/signup/main.scss index a903e03d..c5038a1d 100644 --- a/browser/scss/signup/main.scss +++ b/browser/scss/signup/main.scss @@ -23,4 +23,8 @@ #signup-form { @include form-body; + a { + border-bottom: none; + padding: 5px; + } } diff --git a/server/app/configure/authentication/facebook.js b/server/app/configure/authentication/facebook.js index de731629..eb974807 100644 --- a/server/app/configure/authentication/facebook.js +++ b/server/app/configure/authentication/facebook.js @@ -15,6 +15,14 @@ module.exports = function (app, db) { }; var verifyCallback = function (accessToken, refreshToken, profile, done) { + //get user's first name via fb oauth + let name = profile.displayName + let info = { + firstName: name.split(' ')[0], + lastName: name.split(' ').slice(1).join(' '), + }; + + console.log('PROFILE \n\n', profile) User.findOne({ where: { @@ -26,7 +34,9 @@ module.exports = function (app, db) { return user; } else { return User.create({ - facebook_id: profile.id + facebook_id: profile.id, + firstName: info.firstName, + lastName: info.lastName }); } }) diff --git a/server/app/configure/authentication/google.js b/server/app/configure/authentication/google.js index e643da20..780220fe 100644 --- a/server/app/configure/authentication/google.js +++ b/server/app/configure/authentication/google.js @@ -16,6 +16,13 @@ module.exports = function (app, db) { }; var verifyCallback = function (accessToken, refreshToken, profile, done) { + //get user's first name via google oauth + let name = profile.displayName + let info = { + firstName: name.split(' ')[0], + lastName: name.split(' ').slice(1).join(' '), + email: profile.emails[0].value + }; User.findOne({ where: { @@ -27,7 +34,10 @@ module.exports = function (app, db) { return user; } else { return User.create({ - google_id: profile.id + google_id: profile.id, + firstName: info.firstName, + lastName: info.lastName, + email: info.email }); } })