Added info about iOS app, fixed validation, started client-side settings validation
parent
cf667dc35a
commit
603260273a
|
@ -38,13 +38,31 @@ router.get('/favicon.ico', (req,res)=>{
|
|||
|
||||
// Endpoint to validate forms
|
||||
router.get('/validate', (req,res)=>{
|
||||
if (req.query.slug) { // validate unique slug
|
||||
User.findOne( {slug:slug(req.query.slug)}, (err,existingUser)=>{
|
||||
if (err) { console.log('/validate error:',err); }
|
||||
if (existingUser && existingUser.id!==req.user) { res.sendStatus(400); }
|
||||
|
||||
// Validate unused slug
|
||||
if (req.query.slug) {
|
||||
User.findOne({ slug: slug(req.query.slug) })
|
||||
.then( (existingUser)=>{
|
||||
if (existingUser && existingUser.id!==req.user) {
|
||||
res.sendStatus(400);
|
||||
}
|
||||
else { res.sendStatus(200); }
|
||||
} );
|
||||
})
|
||||
.catch( (err)=>{ mw.throwErr(err); });
|
||||
}
|
||||
|
||||
// Validate unused email
|
||||
else if (req.query.email) {
|
||||
User.findOne({ email: slug(req.query.email) })
|
||||
.then( (existingUser)=>{
|
||||
if (existingUser && existingUser.id!==req.user) {
|
||||
res.sendStatus(400);
|
||||
}
|
||||
else { res.sendStatus(200); }
|
||||
})
|
||||
.catch( (err)=>{ mw.throwErr(err); });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Link to androidapp in play store
|
||||
|
@ -54,8 +72,7 @@ router.get('/android', (req,res)=>{
|
|||
|
||||
// Link to iphone app in the apple store
|
||||
router.get('/ios', (req,res)=>{
|
||||
res.sendStatus(404);
|
||||
//TODO: Add link to info about why there's no ios app
|
||||
res.redirect('/help#why-is-there-no-ios-app');
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -44,7 +44,10 @@ router
|
|||
res.render('settings');
|
||||
})
|
||||
.post('/settings', (req,res)=>{
|
||||
|
||||
//TODO: Test validation here.
|
||||
|
||||
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -55,6 +55,7 @@
|
|||
<li><a href="#how-is-the-altitude-determined">How is the altitude determined?</a></li>
|
||||
<li><a href="#what-is-the-streetview-image">What is the street view image?</a></li>
|
||||
<li><a href="#can-i-contribute-to-tracman">Can I contribute to Tracman?</a></li>
|
||||
<li><a href="#why-is-there-no-ios-app">Why is there no iOS app?</a></li>
|
||||
</ul>
|
||||
|
||||
<h3 id='how-do-i-share-my-location'>How do I share my location?</h3>
|
||||
|
@ -84,6 +85,16 @@
|
|||
<p>Sure! Tracman has some <a href="https://github.com/Tracman-org/">github repositories</a> you can clone. </p>
|
||||
|
||||
<p>I also accept donations to help with development and server fees. You can pay with <a href="https://cash.me/$KeithIrwin">cash</a> or <a href="bitcoin:16KY9k6qdXqDD3mWwr8hrD7ky18AqYSJDo?label=tracman">bitcoin</a>. </p>
|
||||
|
||||
<h3 id='why-is-there-no-ios-app'>Why is there no iOS app?</h3>
|
||||
|
||||
<p>There are a few reasons I haven't made a version of the <a href="/android">android app</a> for iPhone/iPad/iPod: </p>
|
||||
|
||||
<ul>
|
||||
<li>I would need to learn a new programming language, and spend tons of time developing the app. I can't just copy the android code over. Everything would need to be built from scratch. </li>
|
||||
<li>Apple charges $100/year in developer fees. </li>
|
||||
<li>iOS apps can only be built using a mac. </li>
|
||||
</ul>
|
||||
|
||||
<a href="/map" class='btn' style="width:60%; position:relative; left:20%; background:#333">Go to map <i class='fa fa-angle-right'></i></a>
|
||||
|
||||
|
|
|
@ -196,23 +196,5 @@
|
|||
|
||||
{% block javascript %}
|
||||
{{super()}}
|
||||
<script>
|
||||
|
||||
// Delete account
|
||||
function deleteAccount() {
|
||||
if (confirm("Are you sure you want to delete your account? This CANNOT be undone! ")) {
|
||||
$.ajax({
|
||||
url: "/settings",
|
||||
type: "DELETE",
|
||||
success: function(){
|
||||
location.reload();
|
||||
},
|
||||
fail: function(){
|
||||
alert("Failed to delete account!");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/js/.settings.min.js"></script>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue