diff --git a/passport/local-login.js b/passport/local-login.js index b27d6aea..719ce1ee 100644 --- a/passport/local-login.js +++ b/passport/local-login.js @@ -10,6 +10,7 @@ module.exports = new PassportLocalStrategy( passReqToCallback: true, }, (req, username, password, done) => { + logger.debug('verifying loggin attempt'); username = `@${username}`; return db.User .findOne({where: {channelName: username}}) diff --git a/public/assets/css/generalStyle.css b/public/assets/css/generalStyle.css index d1d0c1c7..8d2babcc 100644 --- a/public/assets/css/generalStyle.css +++ b/public/assets/css/generalStyle.css @@ -2,6 +2,7 @@ body, button, input, textarea, label, select, option { font-family: serif; } /* Containters */ + .wrapper { margin-left: 20%; width:60%; @@ -76,6 +77,7 @@ a, a:visited { color: blue; text-decoration: none; } + h1 { font-size: x-large; } @@ -111,6 +113,26 @@ table { text-align: left; } +button { + border: 1px solid black; + padding: 0.5em; + margin: 0.5em 0 0.5em 0; + color: black; + background-color: white; +} + +button:hover, button:focus { + border: 1px solid blue; + color: white; + background-color: blue; +} + +button:active{ + border: 1px solid blue; + color: white; + background-color: white; +} + .stop-float { clear: both; } @@ -137,10 +159,14 @@ table { color: red; } +input:-webkit-autofill { + -webkit-box-shadow: 0 0 0px 1000px white inset; +} + .input-text { outline: none; border: 0px; - background-color: #ffffff; + background-color: white; } .input-text--primary { diff --git a/public/assets/js/publishChannelFunctions.js b/public/assets/js/authFunctions.js similarity index 85% rename from public/assets/js/publishChannelFunctions.js rename to public/assets/js/authFunctions.js index 49bc7abb..5b52ee4c 100644 --- a/public/assets/js/publishChannelFunctions.js +++ b/public/assets/js/authFunctions.js @@ -1,11 +1,11 @@ -function sendSignupRequest (channelName, password) { +function sendAuthRequest (channelName, password, url) { // url === /signup or /login return new Promise(function(resolve, reject) { // make sure the claim name is still available let xhttp; const params = `username=${channelName}&password=${password}`; - console.log(params); + console.log(params, url); xhttp = new XMLHttpRequest(); - xhttp.open('POST', '/api/signup', true); + xhttp.open('POST', url, true); xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhttp.responseType = 'json'; xhttp.onreadystatechange = function() { diff --git a/routes/api-routes.js b/routes/api-routes.js index 9895a21a..8ed5858b 100644 --- a/routes/api-routes.js +++ b/routes/api-routes.js @@ -6,18 +6,8 @@ const { getClaimList, resolveUri } = require('../helpers/lbryApi.js'); const { createPublishParams, validateFile, checkClaimNameAvailability, checkChannelAvailability } = require('../helpers/publishHelpers.js'); const errorHandlers = require('../helpers/errorHandlers.js'); const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); -const passport = require('passport'); -module.exports = (app, hostedContentPath) => { - // route for auth - app.post('/api/signup', passport.authenticate('local-signup'), (req, res) => { - logger.debug('successful signup'); - res.status(200).json(true); - }); - app.post('/api/login', passport.authenticate('local-login'), (req, res) => { - logger.debug('successful login'); - res.status(200).json(true); - }); +module.exports = (app) => { // route to run a claim_list request on the daemon app.get('/api/claim_list/:name', ({ headers, ip, originalUrl, params }, res) => { // google analytics diff --git a/routes/auth-routes.js b/routes/auth-routes.js new file mode 100644 index 00000000..39c0ef0f --- /dev/null +++ b/routes/auth-routes.js @@ -0,0 +1,15 @@ +const logger = require('winston'); +const passport = require('passport'); + +module.exports = (app) => { + // route for sign up + app.post('/signup', passport.authenticate('local-signup'), (req, res) => { + logger.debug('successful signup'); + res.status(200).json(true); + }); + // route for log in + app.post('/login', passport.authenticate('local-login'), (req, res) => { + logger.debug('successful login'); + res.status(200).json(true); + }); +}; diff --git a/routes/page-routes.js b/routes/page-routes.js index 4630bd6c..fee208a8 100644 --- a/routes/page-routes.js +++ b/routes/page-routes.js @@ -1,28 +1,12 @@ const errorHandlers = require('../helpers/errorHandlers.js'); const { postToStats, getStatsSummary, getTrendingClaims, getRecentClaims } = require('../controllers/statsController.js'); -const passport = require('passport'); -const logger = require('winston'); module.exports = (app) => { - // route for auth - app.post('/signup', passport.authenticate('local-signup'), (req, res) => { - logger.debug('redirecting to user channel'); - // If this function gets called, signup was successful. - // `req.user` contains the authenticated user. - res.redirect(`/${req.user.channelName}`); - }); - app.post('/login', passport.authenticate('local-login'), (req, res) => { - logger.debug('redirecting to user channel'); - // If this function gets called, login was successful. - // `req.user` contains the authenticated user. - res.redirect(`/${req.user.channelName}`); - }); // route to log out app.get('/logout', (req, res) => { req.logout(); res.redirect('/login'); }); - // route to display login page app.get('/login', (req, res) => { if (req.user) { @@ -31,14 +15,6 @@ module.exports = (app) => { res.status(200).render('login'); } }); - // route to display login page - // app.get('/users/:name', isAuthenticated, (req, res) => { - // res.status(200).render('profile'); - // }); - // app.get('/logout', deAuthenticate, (req, res) => { - // res.status(200).render('/'); - // }); - // route to show 'about' page for spee.ch app.get('/about', (req, res) => { // get and render the content diff --git a/speech.js b/speech.js index f5663baf..2f8066c1 100644 --- a/speech.js +++ b/speech.js @@ -88,7 +88,8 @@ db.sequelize // add the hosted content folder at a static path app.use('/media', express.static(hostedContentPath)); // require routes & wrap in socket.io - require('./routes/api-routes.js')(app, hostedContentPath); + require('./routes/auth-routes.js')(app); + require('./routes/api-routes.js')(app); require('./routes/page-routes.js')(app); require('./routes/serve-routes.js')(app); require('./routes/home-routes.js')(app); diff --git a/views/login.handlebars b/views/login.handlebars index daa6de4b..b415c9bf 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -4,19 +4,17 @@
Log in to an existing channel:
- +Create a brand new channel:
@@ -24,23 +22,23 @@+
+ + +- +
Drag and drop your file here, or choose your file below.
-Drag and drop your file here, or choose your file below.
- +