Skip to content

Commit

Permalink
Add session
Browse files Browse the repository at this point in the history
  • Loading branch information
stoodkev committed Aug 20, 2018
1 parent 879699d commit 9257d3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,31 @@ app.get("/view/:name", function(req, res) {
}
},
error: function() {
res.redirect("/error/wrong");
res.redirect("/error/sth_wrong");
}
});
});
});

// Create a route to link to the trail
app.get("/link_trail/:link_trail", function(req, res) {
req.session.link_trail = req.params.link_trail;
const community = Parse.Object.extend("Communities");
const query = new Parse.Query(community);
query.equalTo("link_trail", req.params.link_trail);
query.limit(1);
query.find({
success: function(communities) {
if(communities.length==1)
res.redirect("https://steemconnect.com/oauth2/authorize?client_id="+config.appId+"&redirect_uri=/create_trail&response_type=code&scope=offline,comment,vote,comment_option,custom_json");
else {
res.redirect("/error/wrong_page");
}
}
});
});


//Edit community page
app.get("/edit/:name", function(req, res) {
//TODO : Edit Page
Expand Down
3 changes: 2 additions & 1 deletion messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const messages = {
creation_error: "There was a problem and your community could not be created. Please try again!",
login: "Please login to access to this page!",
sth_wrong: "Something went wrong! Please try again later!",
no_community: "We cannot find the community you're looking for! "
no_community: "We cannot find the community you're looking for! ",
wrong_page:"The page you are looking for does not exist!"
};

module.exports = messages;

0 comments on commit 9257d3e

Please sign in to comment.