I just need a hard coded password protected page. I used href to redirect to a page as /admin/user/password:
<a ng-href="/admin//" class="form-control btn btn-primary" >Submit</a>
I am using angular $scope.user and $scope.password as my ng-models for input fields. This request is caught by Express route.get function:
app.route('/admin/:user/:password')
.get(admin.renderAdmin);
Below is my admin.renderAdmin Page :
exports.renderAdmin = function (req, res) {
console.log("Requested with username and password");
if (req.params.user === "*******" && req.params.password === "******") {
res.location('/admin');
res.render('admin');
} else {
res.send(null);
}
};
/admin is the url that i require and admin.ejs stores the html that i want to render on this url.
The output that i am getting is the page renders the admin.ejs but the url is not changing and it is the same as href.
Kindly help me on what i might be doing wrong here. Thanks in advance.
via Himanshu Dewangan
No comments:
Post a Comment