From 100b830871dc543c888f80360b2a51b8f5e3179c Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 11 Oct 2017 15:15:38 -0600 Subject: [PATCH] done with shit --- public/createItem.html | 2 +- public/item.html | 2 +- public/itemEdit.html | 2 +- public/js/main.js | 16 ---------------- public/js/nav.js | 16 ++++++++++++++++ public/stylesheets/userSignIn.css | 4 ++++ public/stylesheets/userSignup.css | 4 ++++ public/userProfile.html | 1 + public/userSignUp.html | 4 ++++ routes/token.js | 3 ++- 10 files changed, 34 insertions(+), 20 deletions(-) diff --git a/public/createItem.html b/public/createItem.html index 13cc366..73bb6fe 100644 --- a/public/createItem.html +++ b/public/createItem.html @@ -48,7 +48,7 @@ diff --git a/public/item.html b/public/item.html index ae7e148..d3f4daa 100644 --- a/public/item.html +++ b/public/item.html @@ -42,7 +42,7 @@
  • -
  • account_circle
  • +
  • account_circle
  • diff --git a/public/itemEdit.html b/public/itemEdit.html index 1c81b33..26a40f2 100644 --- a/public/itemEdit.html +++ b/public/itemEdit.html @@ -43,7 +43,7 @@ diff --git a/public/js/main.js b/public/js/main.js index f1995b5..4a7653e 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -4,22 +4,6 @@ $(document).ready(() => { $('#myInput').val('') - $('#profileButton').click(function() { - - - $.getJSON('/token') - .done((data) => { - if (data.hasToken === false) { - Materialize.toast('You must be logged in to view that!', 3000); - } else { - window.location.href = `/userProfile.html?id=${data.cookies.userId}`; - } - console.log(data.hasToken) - }) - - console.log('test') - }) - const slick = function () { $.getJSON('/items') diff --git a/public/js/nav.js b/public/js/nav.js index 113b03e..f3b0c26 100644 --- a/public/js/nav.js +++ b/public/js/nav.js @@ -4,6 +4,22 @@ $(document).ready(() => { console.log('ready test') + $('#profileButton').click(function() { + + + $.getJSON('/token') + .done((data) => { + if (data.hasToken === false) { + Materialize.toast('You must be logged in to view that!', 3000); + } else { + window.location.href = `/userProfile.html?id=${data.cookies.userId}`; + } + console.log(data.hasToken) + }) + + console.log('test') + }) + $.getJSON('/token') .done((data) => { const $firstNavItems = $('.firstNavItem'); diff --git a/public/stylesheets/userSignIn.css b/public/stylesheets/userSignIn.css index e691ef0..9cde73b 100644 --- a/public/stylesheets/userSignIn.css +++ b/public/stylesheets/userSignIn.css @@ -3,3 +3,7 @@ body { width: 100%; /*background-color: red;*/ } + +nav { + background-color: #6BBA54 !important; +} diff --git a/public/stylesheets/userSignup.css b/public/stylesheets/userSignup.css index e691ef0..9cde73b 100644 --- a/public/stylesheets/userSignup.css +++ b/public/stylesheets/userSignup.css @@ -3,3 +3,7 @@ body { width: 100%; /*background-color: red;*/ } + +nav { + background-color: #6BBA54 !important; +} diff --git a/public/userProfile.html b/public/userProfile.html index 964d474..fbe5a80 100644 --- a/public/userProfile.html +++ b/public/userProfile.html @@ -47,6 +47,7 @@ diff --git a/public/userSignUp.html b/public/userSignUp.html index 213b582..c2eb524 100644 --- a/public/userSignUp.html +++ b/public/userSignUp.html @@ -22,6 +22,7 @@ + @@ -40,6 +41,9 @@ diff --git a/routes/token.js b/routes/token.js index 95e20ac..b691cc4 100644 --- a/routes/token.js +++ b/routes/token.js @@ -41,10 +41,11 @@ router.post('/token', (req, res, next) => { knex('users') .where('email', email) + .orWhere('username', email) .first() .then((row) => { if (!row) { - throw boom.create(400, 'Bad email or password'); + throw Materialize.toast('Bad email or password', 3000); } user = camelizeKeys(row);