diff --git a/.DS_Store b/.DS_Store index 01584cc..1bb26b9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..35e47e8 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "longshotauth" + } +} diff --git a/database.rules.json b/database.rules.json new file mode 100644 index 0000000..d2b8268 --- /dev/null +++ b/database.rules.json @@ -0,0 +1,6 @@ +{ + "rules": { + ".read": true, + ".write": true + } +} diff --git a/firebase-debug.log b/firebase-debug.log new file mode 100644 index 0000000..0be7bc6 --- /dev/null +++ b/firebase-debug.log @@ -0,0 +1,171 @@ +[debug] [2018-01-21T01:44:01.954Z] ---------------------------------------------------------------------- +[debug] [2018-01-21T01:44:01.958Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve +[debug] [2018-01-21T01:44:01.958Z] CLI Version: 3.17.3 +[debug] [2018-01-21T01:44:01.958Z] Platform: darwin +[debug] [2018-01-21T01:44:01.958Z] Node Version: v8.5.0 +[debug] [2018-01-21T01:44:01.964Z] Time: Sat Jan 20 2018 19:44:01 GMT-0600 (CST) +[debug] [2018-01-21T01:44:01.964Z] ---------------------------------------------------------------------- +[debug] +[debug] [2018-01-21T01:44:01.973Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] +[debug] [2018-01-21T01:44:01.974Z] > authorizing via signed-in user +[debug] [2018-01-21T01:44:01.975Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"] +[debug] [2018-01-21T01:44:01.975Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token + { refresh_token: '1/8xsTvQfVvHXSipMTAJzSy5uhqtUWBrPoQXaMsT79kRw', + client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com', + client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi', + grant_type: 'refresh_token', + scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' } + Sat Jan 20 2018 19:44:01 GMT-0600 (CST) +[debug] [2018-01-21T01:44:02.179Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T01:44:02.197Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth + + Sat Jan 20 2018 19:44:02 GMT-0600 (CST) +[debug] [2018-01-21T01:44:02.518Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T01:44:02.519Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens + + Sat Jan 20 2018 19:44:02 GMT-0600 (CST) +[debug] [2018-01-21T01:44:03.163Z] <<< HTTP RESPONSE 200 +[info] +[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'... +[info] +[debug] [2018-01-21T01:44:03.167Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth + + Sat Jan 20 2018 19:44:03 GMT-0600 (CST) +[debug] [2018-01-21T01:44:03.534Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T01:44:03.535Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig + + Sat Jan 20 2018 19:44:03 GMT-0600 (CST) +[debug] [2018-01-21T01:44:04.912Z] <<< HTTP RESPONSE 200 +[info] i hosting: Serving hosting files from: public +[info] ✔ hosting: Local server: http://localhost:5000 + +[debug] [2018-01-21T01:45:51.609Z] ---------------------------------------------------------------------- +[debug] [2018-01-21T01:45:51.611Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve +[debug] [2018-01-21T01:45:51.611Z] CLI Version: 3.17.3 +[debug] [2018-01-21T01:45:51.611Z] Platform: darwin +[debug] [2018-01-21T01:45:51.611Z] Node Version: v8.5.0 +[debug] [2018-01-21T01:45:51.612Z] Time: Sat Jan 20 2018 19:45:51 GMT-0600 (CST) +[debug] [2018-01-21T01:45:51.612Z] ---------------------------------------------------------------------- +[debug] +[debug] [2018-01-21T01:45:51.622Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] +[debug] [2018-01-21T01:45:51.622Z] > authorizing via signed-in user +[debug] [2018-01-21T01:45:51.624Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth + + Sat Jan 20 2018 19:45:51 GMT-0600 (CST) +[debug] [2018-01-21T01:45:53.355Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T01:45:53.356Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens + + Sat Jan 20 2018 19:45:53 GMT-0600 (CST) +[debug] [2018-01-21T01:45:53.627Z] <<< HTTP RESPONSE 200 +[info] +[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'... +[info] +[debug] [2018-01-21T01:45:53.630Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth + + Sat Jan 20 2018 19:45:53 GMT-0600 (CST) +[debug] [2018-01-21T01:45:53.984Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T01:45:53.984Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig + + Sat Jan 20 2018 19:45:53 GMT-0600 (CST) +[debug] [2018-01-21T01:45:54.292Z] <<< HTTP RESPONSE 200 +[info] i hosting: Serving hosting files from: public +[info] ✔ hosting: Local server: http://localhost:5000 + +[debug] [2018-01-21T03:18:11.322Z] ---------------------------------------------------------------------- +[debug] [2018-01-21T03:18:11.329Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve +[debug] [2018-01-21T03:18:11.329Z] CLI Version: 3.17.3 +[debug] [2018-01-21T03:18:11.329Z] Platform: darwin +[debug] [2018-01-21T03:18:11.329Z] Node Version: v8.5.0 +[debug] [2018-01-21T03:18:11.330Z] Time: Sat Jan 20 2018 21:18:11 GMT-0600 (CST) +[debug] [2018-01-21T03:18:11.330Z] ---------------------------------------------------------------------- +[debug] +[debug] [2018-01-21T03:18:11.339Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] +[debug] [2018-01-21T03:18:11.339Z] > authorizing via signed-in user +[debug] [2018-01-21T03:18:11.341Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"] +[debug] [2018-01-21T03:18:11.341Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token + { refresh_token: '1/8xsTvQfVvHXSipMTAJzSy5uhqtUWBrPoQXaMsT79kRw', + client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com', + client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi', + grant_type: 'refresh_token', + scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' } + Sat Jan 20 2018 21:18:11 GMT-0600 (CST) +[debug] [2018-01-21T03:18:15.375Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T03:18:15.390Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth + + Sat Jan 20 2018 21:18:15 GMT-0600 (CST) +[debug] [2018-01-21T03:18:15.792Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T03:18:15.793Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens + + Sat Jan 20 2018 21:18:15 GMT-0600 (CST) +[debug] [2018-01-21T03:18:16.280Z] <<< HTTP RESPONSE 200 +[info] +[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'... +[info] +[debug] [2018-01-21T03:18:16.283Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth + + Sat Jan 20 2018 21:18:16 GMT-0600 (CST) +[debug] [2018-01-21T03:18:16.808Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T03:18:16.809Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig + + Sat Jan 20 2018 21:18:16 GMT-0600 (CST) +[debug] [2018-01-21T03:18:18.232Z] <<< HTTP RESPONSE 200 +[info] i hosting: Serving hosting files from: public +[info] ✔ hosting: Local server: http://localhost:5000 + +[debug] [2018-01-21T03:31:53.995Z] ---------------------------------------------------------------------- +[debug] [2018-01-21T03:31:53.996Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase init +[debug] [2018-01-21T03:31:53.997Z] CLI Version: 3.17.3 +[debug] [2018-01-21T03:31:53.997Z] Platform: darwin +[debug] [2018-01-21T03:31:53.997Z] Node Version: v8.5.0 +[debug] [2018-01-21T03:31:53.997Z] Time: Sat Jan 20 2018 21:31:53 GMT-0600 (CST) +[debug] [2018-01-21T03:31:53.997Z] ---------------------------------------------------------------------- +[debug] +[debug] [2018-01-21T03:31:54.006Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"] +[debug] [2018-01-21T03:31:54.006Z] > authorizing via signed-in user +[info] + 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 + 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 + 🔥🔥🔥🔥🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥 + 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 + 🔥🔥 🔥🔥🔥🔥 🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 + +You're about to initialize a Firebase project in this directory: + + /Users/idajensen/Documents/umnbootcamp/Project-Longshot + +Before we get started, keep in mind: + + * You are initializing in an existing Firebase project directory + +[debug] [2018-01-21T03:33:54.418Z] ---------------------------------------------------------------------- +[debug] [2018-01-21T03:33:54.420Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve +[debug] [2018-01-21T03:33:54.420Z] CLI Version: 3.17.3 +[debug] [2018-01-21T03:33:54.420Z] Platform: darwin +[debug] [2018-01-21T03:33:54.420Z] Node Version: v8.5.0 +[debug] [2018-01-21T03:33:54.421Z] Time: Sat Jan 20 2018 21:33:54 GMT-0600 (CST) +[debug] [2018-01-21T03:33:54.421Z] ---------------------------------------------------------------------- +[debug] +[debug] [2018-01-21T03:33:54.430Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] +[debug] [2018-01-21T03:33:54.430Z] > authorizing via signed-in user +[debug] [2018-01-21T03:33:54.432Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth + + Sat Jan 20 2018 21:33:54 GMT-0600 (CST) +[debug] [2018-01-21T03:33:58.688Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T03:33:58.689Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens + + Sat Jan 20 2018 21:33:58 GMT-0600 (CST) +[debug] [2018-01-21T03:33:59.017Z] <<< HTTP RESPONSE 200 +[info] +[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'... +[info] +[debug] [2018-01-21T03:33:59.020Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth + + Sat Jan 20 2018 21:33:59 GMT-0600 (CST) +[debug] [2018-01-21T03:33:59.282Z] <<< HTTP RESPONSE 200 +[debug] [2018-01-21T03:33:59.282Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig + + Sat Jan 20 2018 21:33:59 GMT-0600 (CST) +[debug] [2018-01-21T03:33:59.718Z] <<< HTTP RESPONSE 200 +[info] i hosting: Serving hosting files from: public +[info] ✔ hosting: Local server: http://localhost:5000 + diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..94a0b21 --- /dev/null +++ b/firebase.json @@ -0,0 +1,19 @@ +{ + "database": { + "rules": "database.rules.json" + }, + "hosting": { + "public": "public", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} diff --git a/assets/.DS_Store b/public/assets/.DS_Store similarity index 100% rename from assets/.DS_Store rename to public/assets/.DS_Store diff --git a/assets/css/.DS_Store b/public/assets/css/.DS_Store similarity index 100% rename from assets/css/.DS_Store rename to public/assets/css/.DS_Store diff --git a/assets/css/animate.css b/public/assets/css/animate.css similarity index 100% rename from assets/css/animate.css rename to public/assets/css/animate.css diff --git a/assets/css/reset.css b/public/assets/css/reset.css similarity index 100% rename from assets/css/reset.css rename to public/assets/css/reset.css diff --git a/assets/css/style.css b/public/assets/css/style.css similarity index 100% rename from assets/css/style.css rename to public/assets/css/style.css diff --git a/assets/images/.DS_Store b/public/assets/images/.DS_Store similarity index 100% rename from assets/images/.DS_Store rename to public/assets/images/.DS_Store diff --git a/assets/images/sample-1.jpg b/public/assets/images/sample-1.jpg similarity index 100% rename from assets/images/sample-1.jpg rename to public/assets/images/sample-1.jpg diff --git a/assets/javascript/.DS_Store b/public/assets/javascript/.DS_Store similarity index 100% rename from assets/javascript/.DS_Store rename to public/assets/javascript/.DS_Store diff --git a/assets/javascript/app.js b/public/assets/javascript/app.js similarity index 77% rename from assets/javascript/app.js rename to public/assets/javascript/app.js index 0dcfb9d..d198a9d 100644 --- a/assets/javascript/app.js +++ b/public/assets/javascript/app.js @@ -1,15 +1,17 @@ // Initialize Firebase var config = { - apiKey: "AIzaSyCC1t5np8kPEV2yC0heaC4z0l6JtYNEMhY", - authDomain: "projectlongshot-469ee.firebaseapp.com", - databaseURL: "https://projectlongshot-469ee.firebaseio.com", - projectId: "projectlongshot-469ee", - storageBucket: "", - messagingSenderId: "333236357647" + apiKey: "AIzaSyCOVL51USj4HE7VfyPOI21R3uZT8yTa10c", + authDomain: "longshotauth.firebaseapp.com", + databaseURL: "https://longshotauth.firebaseio.com", + projectId: "longshotauth", + storageBucket: "", + messagingSenderId: "783961136211" }; firebase.initializeApp(config); database = firebase.database(); +// var defaultAuth = firebase.auth(); + var queryURLbase = "https://api.edamam.com/search?&app_id=4a5d81a2&app_key=379308ab9da9a8ee47f63563d2774ac4&from=0&to9&q="; var userInput; @@ -19,12 +21,10 @@ var label; var recipe; var sourceLink; -function testAjax(queryURL) { - $.ajax({ - url: queryURL, - method: 'GET' - }).done(function(data) { - console.log(data); +function testAjax(queryURL){ +fetch(queryURL) +.then((resp) => resp.json()) +.then(function(data){ // console.log(queryURL); for(var i = 0; i < 9; i++){ @@ -133,7 +133,7 @@ function testAjax(queryURL) { }) }; }); -}; +} $("#submit").on("click",function(e){ e.preventDefault(); @@ -148,12 +148,58 @@ $("#submit").on("click",function(e){ testAjax(searchURL); }); +// +// +//function to detect auth state change +firebase.auth().onAuthStateChanged(function(user) { + if (user) { + alert("user signed in"); + // User is signed in. + $("#logout-btn").show(); + $("#login-btn").hide(); + $("#signup-btn").hide(); + var user = firebase.auth().currentUser; + if (user != null){ + var email_id =user.email; + $("#member-info").text(email_id); + } + } else { + // No user is signed in. + $("#logout-btn").hide(); + $("#login-btn").show(); + $("#signup-btn").show(); + } +}); +//click event for sign up +function signUp(){ + var userEmail = $("#email-input").val().trim(); + var userPass = $("#password-input").val().trim(); + firebase.auth().createUserWithEmailAndPassword(userEmail, userPass).catch(function(error) { + // Handle Errors here. + var errorCode = error.code; + var errorMessage = error.message; + // ... + window.alert("Error : " + errorMessage); +}); +} +//click event for logOut +function logOut(){ + firebase.auth().signOut(); +} +// Click event for sign in. +function login(){ + var userEmail = $("#email-input").val().trim(); + var userPass = $("#password-input").val().trim(); + firebase.auth().signInWithEmailAndPassword(userEmail, userPass).catch(function(error) { + // Handle Errors here. + var errorCode = error.code; + var errorMessage = error.message; + // ... + window.alert("Error : " + errorMessage); -//Click event for sign in. -$("#authentication-btn").on("click", function() { - console.log("Sign in button clicked"); }); +} //Trigger bottom sheet to open recipe box. $(document).ready(function(){ @@ -214,15 +260,15 @@ $(document).on("click",".remove",function(e) { return database.ref().update(updates); }; }) - //}); + }); + + // If user decides that they don't want to remove the recipe from the recipe box... + $('#no-remove').on("click", function(){ + return; + }); - //If user decides that they don't want to remove the recipe from the recipe box... - //$('#no-remove').on("click", function(){ - //return; - //}); -}); -//When Help link in the Footer is clicked, open help page. +// When Help link in the Footer is clicked, open help page. $("#help-link").on("click", function(){ $("#help-modal").modal('open'); }) @@ -230,4 +276,4 @@ $("#help-link").on("click", function(){ //When About link in the Footer is clicked, open about page. $("#about-link").on("click", function(){ $("#about-modal").modal('open'); -}) +}); diff --git a/assets/javascript/game.js b/public/assets/javascript/game.js similarity index 100% rename from assets/javascript/game.js rename to public/assets/javascript/game.js diff --git a/index.html b/public/index.html similarity index 94% rename from index.html rename to public/index.html index 8a00718..8101201 100644 --- a/index.html +++ b/public/index.html @@ -43,7 +43,10 @@ Recipe Search App @@ -128,7 +131,10 @@
Recipe Search App
- + + + + + +