From 94f19d836cfc80cd9d4fcfed17c1e2f025002994 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 7 Nov 2014 18:29:00 -0500 Subject: alias login -> signin --- server/lib/auth/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'server/lib/auth') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index c2275ff..0c46105 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -30,14 +30,13 @@ var auth = { callbackURL: 'http://' + config.host + '/auth/twitter/callback' }, auth.insertTwitterUser)); - /* passport.use(new FacebookStrategy({ clientID: process.env.VVALLS_FACEBOOK_KEY || '719828821410310', clientSecret: process.env.VVALLS_FACEBOOK_SECRET || 'f9aba78e08f37f621eadb88b1409d48c', callbackURL: 'http://' + config.host + '/auth/facebook/callback', enableProof: false, }, auth.insertFacebookUser)); - */ + auth.mail.init() }, -- cgit v1.2.3-70-g09d2 From 9ef3f0ec50c965396a2271182dd27dc5b6539081 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 13 Nov 2014 12:21:23 -0500 Subject: correct style Vvalls -> VValls everywhere --- public/assets/stylesheets/app.css | 5 ++--- server/lib/auth/mail.js | 4 ++-- server/lib/middleware.js | 4 ++-- server/lib/util.js | 2 +- server/lib/views/index.js | 2 +- views/controls/editor/collaborators.ejs | 2 +- views/controls/reader/embed.ejs | 2 +- views/mail/collaborator.html.ejs | 2 +- views/mail/collaborator.text.ejs | 2 +- views/mail/welcome.html.ejs | 2 +- views/mail/welcome.text.ejs | 2 +- views/partials/meta.ejs | 2 +- 12 files changed, 15 insertions(+), 16 deletions(-) (limited to 'server/lib/auth') diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 48c6e97..57c7197 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -596,7 +596,6 @@ iframe.embed { border-top: 0px solid; font-weight: 500; font-size: 40px; - text-transform:capitalize; } .docs .content img { max-width: 90%; @@ -643,8 +642,8 @@ iframe.embed { text-decoration:underline; } -.docs .content.doc-privacy p, -.docs .content.doc-terms p { +.docs .content.doc-privacy, +.docs .content.doc-terms { font-size: 15px; line-height: 25px; font-weight: 300; diff --git a/server/lib/auth/mail.js b/server/lib/auth/mail.js index 0ba6d5d..eac4007 100644 --- a/server/lib/auth/mail.js +++ b/server/lib/auth/mail.js @@ -6,7 +6,7 @@ var email = require("emailjs"), var mail = { - from: 'Vvalls ', + from: 'VValls ', templates: {}, init: function(){ @@ -40,7 +40,7 @@ var mail = { text: mail.templates.welcome.text(user), from: mail.from, to: user.email, - subject: "Welcome to Vvalls", + subject: "Welcome to VValls", attachment: [ { data: mail.templates.welcome.html(user), alternative: true }, ] diff --git a/server/lib/middleware.js b/server/lib/middleware.js index 870451a..60f2e46 100644 --- a/server/lib/middleware.js +++ b/server/lib/middleware.js @@ -41,10 +41,10 @@ var middleware = { res.locals.config = config res.locals.profile = null res.locals.ogImage = "" - res.locals.ogTitle = "Vvalls" + res.locals.ogTitle = "VValls" res.locals.ogUrl = "http://vvalls.com/" res.locals.ogDescription = "3D gallery space, fully customizable" - res.locals.ogAuthor = "Vvalls" + res.locals.ogAuthor = "VValls" res.locals.opt = {} next() }, diff --git a/server/lib/util.js b/server/lib/util.js index 0a71cb7..1f63a30 100644 --- a/server/lib/util.js +++ b/server/lib/util.js @@ -31,7 +31,7 @@ util.escapeRegExp = function (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") } util.htmlize = function(s) { - return ("

" + s.replace(/\n/g,"

") + "

").replace(/

<\/p>/, "
") + return s.replace(/\n/g,"
") } util.cleanQuery = function (query) { diff --git a/server/lib/views/index.js b/server/lib/views/index.js index b3a15c2..31cb1db 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -169,7 +169,7 @@ var views = module.exports = { isOwnProfile: isOwnProfile, profile: user, projects: projects || [], - ogTitle: "Vvalls: Profile of " + user.displayName, + ogTitle: "VValls: Profile of " + user.displayName, ogUrl: "http://vvalls.com/profile/" + user.username + "/", ogImage: user.photo, }) diff --git a/views/controls/editor/collaborators.ejs b/views/controls/editor/collaborators.ejs index 8ad8c00..5de7d25 100644 --- a/views/controls/editor/collaborators.ejs +++ b/views/controls/editor/collaborators.ejs @@ -7,7 +7,7 @@

Collaborators

- To invite others to contribute to this project, submit their email address below. They'll receive an email with instructions to join this project and register if they're not a Vvalls user yet. + To invite others to contribute to this project, submit their email address below. They'll receive an email with instructions to join this project and register if they're not a VValls user yet.

diff --git a/views/controls/reader/embed.ejs b/views/controls/reader/embed.ejs index cc21c74..814644d 100644 --- a/views/controls/reader/embed.ejs +++ b/views/controls/reader/embed.ejs @@ -4,7 +4,7 @@
-

Embed Vvalls

+

Embed VValls

This code generates an iframe which will embed this room in your website or blog. diff --git a/views/mail/collaborator.html.ejs b/views/mail/collaborator.html.ejs index 2a08a1c..c4832d1 100644 --- a/views/mail/collaborator.html.ejs +++ b/views/mail/collaborator.html.ejs @@ -7,7 +7,7 @@

[[- username ]] has invited you to join the project - [[- projectName ]] on Vvalls. + [[- projectName ]] on VValls.

diff --git a/views/mail/collaborator.text.ejs b/views/mail/collaborator.text.ejs index 52d39b6..2de78ad 100644 --- a/views/mail/collaborator.text.ejs +++ b/views/mail/collaborator.text.ejs @@ -1,5 +1,5 @@ -[[- username ]] has invited you to join the project [[- projectName ]] on Vvalls. +[[- username ]] has invited you to join the project [[- projectName ]] on VValls. Accept the invitation below: diff --git a/views/mail/welcome.html.ejs b/views/mail/welcome.html.ejs index b2c329f..1d45faf 100644 --- a/views/mail/welcome.html.ejs +++ b/views/mail/welcome.html.ejs @@ -6,7 +6,7 @@

- Welcome to Vvalls, [[- username ]] + Welcome to VValls, [[- username ]]

diff --git a/views/mail/welcome.text.ejs b/views/mail/welcome.text.ejs index 02b449b..5c0b51d 100644 --- a/views/mail/welcome.text.ejs +++ b/views/mail/welcome.text.ejs @@ -1,4 +1,4 @@ -Welcome to Vvalls, [[- username ]] +Welcome to VValls, [[- username ]] http://www.vvalls.com diff --git a/views/partials/meta.ejs b/views/partials/meta.ejs index f1b6f48..defb187 100644 --- a/views/partials/meta.ejs +++ b/views/partials/meta.ejs @@ -25,7 +25,7 @@ - + -- cgit v1.2.3-70-g09d2 From 5d3b848b729c06bda5d4d6d3834b110dcbb3ef71 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Nov 2014 17:08:04 -0500 Subject: use req.ips[0] --- server/lib/auth/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server/lib/auth') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 0c46105..79f1e34 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -86,9 +86,9 @@ var auth = { return res.redirect('/auth/usernameTaken'); } if (! user.created_ip) { - user.created_ip = util.ip2num( req.ip ) + user.created_ip = util.ip2num( req.ips[0] ) } - user.last_ip = util.ip2num( req.ip ) + user.last_ip = util.ip2num( req.ips[0] ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -111,7 +111,7 @@ var auth = { } user.last_seen = new Date () - user.last_ip = util.ip2num( req.ip ) + user.last_ip = util.ip2num( req.ips[0] ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -171,8 +171,8 @@ var auth = { displayName: username, password: password, email: email, - created_ip: util.ip2num( req.ip ), - last_ip: util.ip2num( req.ip ), + created_ip: util.ip2num( req.ips[0] ), + last_ip: util.ip2num( req.ips[0] ), created_at: new Date (), last_seen: new Date (), } -- cgit v1.2.3-70-g09d2 From 0965d0011f1858adae736cfd4df8e88cf1e24893 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Nov 2014 17:30:56 -0500 Subject: z --- server/lib/auth/index.js | 10 +++++----- server/lib/middleware.js | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'server/lib/auth') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 79f1e34..0c46105 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -86,9 +86,9 @@ var auth = { return res.redirect('/auth/usernameTaken'); } if (! user.created_ip) { - user.created_ip = util.ip2num( req.ips[0] ) + user.created_ip = util.ip2num( req.ip ) } - user.last_ip = util.ip2num( req.ips[0] ) + user.last_ip = util.ip2num( req.ip ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -111,7 +111,7 @@ var auth = { } user.last_seen = new Date () - user.last_ip = util.ip2num( req.ips[0] ) + user.last_ip = util.ip2num( req.ip ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -171,8 +171,8 @@ var auth = { displayName: username, password: password, email: email, - created_ip: util.ip2num( req.ips[0] ), - last_ip: util.ip2num( req.ips[0] ), + created_ip: util.ip2num( req.ip ), + last_ip: util.ip2num( req.ip ), created_at: new Date (), last_seen: new Date (), } diff --git a/server/lib/middleware.js b/server/lib/middleware.js index ad0d228..2d24693 100644 --- a/server/lib/middleware.js +++ b/server/lib/middleware.js @@ -38,9 +38,10 @@ var middleware = { if (req.ips) { req.ip = req.session.ip = req.ips[0] } - else { + else if (req.session.ip) { req.ip = req.session.ip || "127.0.0.1" } + next() }, ensureLocals: function (req, res, next) { -- cgit v1.2.3-70-g09d2 From c9325286ba7fcb38166deff8937105789edfb1d2 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Nov 2014 17:40:53 -0500 Subject: need to store ip on the session due to haproxy --- server/lib/auth/index.js | 10 +++++----- server/lib/middleware.js | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'server/lib/auth') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 0c46105..a9a2400 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -86,9 +86,9 @@ var auth = { return res.redirect('/auth/usernameTaken'); } if (! user.created_ip) { - user.created_ip = util.ip2num( req.ip ) + user.created_ip = util.ip2num( req.session.ip ) } - user.last_ip = util.ip2num( req.ip ) + user.last_ip = util.ip2num( req.session.ip ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -111,7 +111,7 @@ var auth = { } user.last_seen = new Date () - user.last_ip = util.ip2num( req.ip ) + user.last_ip = util.ip2num( req.session.ip ) user.save(function(err, data){ if (err) console.err('error setting ip for user') }) req.logIn(user, function(err) { @@ -171,8 +171,8 @@ var auth = { displayName: username, password: password, email: email, - created_ip: util.ip2num( req.ip ), - last_ip: util.ip2num( req.ip ), + created_ip: util.ip2num( req.session.ip ), + last_ip: util.ip2num( req.session.ip ), created_at: new Date (), last_seen: new Date (), } diff --git a/server/lib/middleware.js b/server/lib/middleware.js index 173701d..4848ab0 100644 --- a/server/lib/middleware.js +++ b/server/lib/middleware.js @@ -35,13 +35,13 @@ var middleware = { }, ensureIP: function (req, res, next) { - if (req.ips) { + if (req.session.ip) { + req.ip = req.session.ip || "127.0.0.1" + } + else if (req.ips) { req.ip = req.session.ip = req.ips[0] req.session.save() } - else if (req.session.ip) { - req.ip = req.session.ip || "127.0.0.1" - } next() }, -- cgit v1.2.3-70-g09d2 From d08c86d68ceb22665b735054fc3bc316f85f84c1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 31 Jan 2015 08:51:55 -0500 Subject: billing link in footer --- public/assets/javascripts/ui/site/EditSubscriptionModal.js | 12 ++++++++++-- server/lib/auth/index.js | 4 ++-- views/partials/footer.ejs | 6 ++++++ 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'server/lib/auth') diff --git a/public/assets/javascripts/ui/site/EditSubscriptionModal.js b/public/assets/javascripts/ui/site/EditSubscriptionModal.js index 6823740..82f6903 100644 --- a/public/assets/javascripts/ui/site/EditSubscriptionModal.js +++ b/public/assets/javascripts/ui/site/EditSubscriptionModal.js @@ -12,7 +12,7 @@ var EditSubscriptionModal = ModalView.extend({ events: { "click [data-role='addLayouts']": 'addLayouts', "click [data-role='changePlan']": 'changePlan', - "click [data-role='cancelSubscription']": 'cancelSubscription', + "click [data-role='cancelSubscription']": 'destroy', "click .gear": 'sync', "click .planList button": 'followLink', }, @@ -132,6 +132,13 @@ var EditSubscriptionModal = ModalView.extend({ this.$planTotal.toDollars ( totals.plan_total ) }, + addLayouts: function(e){ + e.preventDefault() + }, + changePlan: function(e){ + e.preventDefault() + }, + sync: function(){ this.$gear.addClass("turning") $.ajax({ @@ -152,7 +159,8 @@ var EditSubscriptionModal = ModalView.extend({ }) }, - destroy: function(){ + destroy: function(e){ + e.preventDefault() var msg = "Are you sure you want to cancel your subscription?" ConfirmModal.confirm(msg, function(){ $.ajax({ diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index a9a2400..199377d 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -135,12 +135,12 @@ var auth = { deserializeUser: function (id, done) { try { var _id = mongoose.Types.ObjectId(id) - User.findOne({ _id: _id }, "_id displayName username photo isStaff", function (err, user) { + User.findOne({ _id: _id }, "_id displayName username photo isStaff plan_level", function (err, user) { done(err, user); }); } catch (e) { - User.findOne({ twitter_id: id }, "_id displayName username photo isStaff", function (err, user) { + User.findOne({ twitter_id: id }, "_id displayName username photo isStaff plan_level", function (err, user) { done(err, user); }); } diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index e3c572f..8a95fc4 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -15,6 +15,12 @@ About How To + + [[ if (logged_in && user.plan_level > 0) { ]] + Billing + [[ } else { ]] + Subscribe + [[ } ]] Terms Privacy Contact -- cgit v1.2.3-70-g09d2 From 78620c1451f78bdb470ed89c8a1e5c7a6bb10990 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 3 Feb 2015 13:07:42 -0500 Subject: support basicAuth --- config.json.example | 3 ++- server/index.js | 1 + server/lib/auth/index.js | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'server/lib/auth') diff --git a/config.json.example b/config.json.example index 7072d48..7221aa0 100644 --- a/config.json.example +++ b/config.json.example @@ -5,5 +5,6 @@ "socketPort": 1337, "webhookPort": 5000, "databaseHost": "lvh.me", - "env": { "development": 1 } + "env": { "development": 1 }, + "basicAuth": { "user": "foo", "pass": "bar" } } diff --git a/server/index.js b/server/index.js index 8c8212f..7bc3f7f 100644 --- a/server/index.js +++ b/server/index.js @@ -39,6 +39,7 @@ site.ready = function(){ site.setup = function(){ var SessionStore = new MongoStore({ mongoose_connection: mongoose.connection }) + auth.initBasicAuth(app) app.set('port', config.port); app.set('views', path.join(__dirname, '../views')); app.set('view engine', 'ejs'); diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 199377d..8e20bcc 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -39,7 +39,14 @@ var auth = { auth.mail.init() }, - + initBasicAuth: function(app){ + if (config.basicAuth) { + app.use(express.basicAuth(function(user, pass) { + return user === config.basicAuth.user && + pass === config.basicAuth.pass + })) + } + }, initSockets: function (io, SessionStore) { io.set('authorization', passportSocketIo.authorize({ cookieParser: express.cookieParser, -- cgit v1.2.3-70-g09d2 From f51b018fd760d8550a06cb900a1311164ea881ad Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 3 Feb 2015 13:15:58 -0500 Subject: emails --- server/lib/auth/mail.js | 2 +- views/home.ejs | 2 +- views/staff/_users.ejs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/lib/auth') diff --git a/server/lib/auth/mail.js b/server/lib/auth/mail.js index eac4007..990b53f 100644 --- a/server/lib/auth/mail.js +++ b/server/lib/auth/mail.js @@ -6,7 +6,7 @@ var email = require("emailjs"), var mail = { - from: 'VValls ', + from: 'VValls ', templates: {}, init: function(){ diff --git a/views/home.ejs b/views/home.ejs index ffb0976..20723a5 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -68,7 +68,7 @@

Ready To Go Pro?

Use VValls as part of your product, service, or marketing campaign. We offer many types of customizations, including automation of layouts, more elaborate floor plans, enhanced video, interactivity, and other features. - Contact + Contact
[[ include partials/confirm-modal ]] diff --git a/views/staff/_users.ejs b/views/staff/_users.ejs index 9caf893..ee988ab 100644 --- a/views/staff/_users.ejs +++ b/views/staff/_users.ejs @@ -1,5 +1,5 @@