#30 Added welcome message

master
Keith Irwin 2017-05-08 20:12:58 -04:00
parent 0c5cf8976f
commit 62427efb91
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
3 changed files with 43 additions and 3 deletions

View File

@ -4,10 +4,16 @@ const router = require('express').Router(),
mw = require('../middleware.js'),
env = require('../env/env.js'),
User = require('../models.js').user;
// Redirect to real slug
router.get('/', mw.ensureAuth, (req,res)=>{
res.redirect(`/map/${req.user.slug}`);
if (req.query.new){
res.redirect(`/map/${req.user.slug}?new=1`);
}
else {
res.redirect(`/map/${req.user.slug}`);
}
});
// Show map
@ -23,7 +29,8 @@ router.get('/:slug?', (req,res,next)=>{
user: req.user,
noFooter: '1',
noHeader: (req.query.noheader)?req.query.noheader.match(/\d/)[0]:0,
disp: (req.query.disp)?req.query.disp.match(/\d/)[0]:2 // 0=map, 1=streetview, 2=both
disp: (req.query.disp)?req.query.disp.match(/\d/)[0]:2, // 0=map, 1=streetview, 2=both
newuserurl: (req.query.new)? env.url+'/map/'+req.params.slug : ''
});
}
}).catch( (err)=>{

View File

@ -316,10 +316,11 @@ router.route('/password/:token')
req.flash('success', 'Your password has been changed. ');
res.redirect('/settings');
}
// New user created password
else {
req.flash('success', 'Password set. You can use it to log in now. ');
res.redirect('/login?next=/settings');
res.redirect('/login?next=/map?new=1');
}
} );

View File

@ -44,6 +44,38 @@
{% block main %}
{% if user and newuserurl %}
<div id='welcome'>
<style>
#welcome {
background: #111;
padding: 3vw;
border-radius: 2vw;
z-index: 50;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#welcome h1 {
display: inline-block;
}
#welcome p {
margin: 0;
}
#welcome .close {
cursor: pointer;
float: right;
}
</style>
<h1>Welcome!</h1>
<span class='close' onclick="$('#welcome').hide();">✖️</span>
<p>This is your map. It's avaliable at <a href="{{newuserurl}}">{{newuserurl}}</a>. You can change that and other settings in <b><a href="/settings">settings</a></b>. Set your location by clicking <b>set</b> below. Clear it by clicking <b>clear</b>. To track your location, click <b>track</b> or download the <a href="/android">android app</a>. For more information, see <a href="/help">the help page</a>. </p>
</div>
{% endif %}
<div id='map'></div>
<div id='pano'></div>