May 2015
Beginner
220 pages
4h 16m
English
The previous sections of this chapter gave us enough knowledge to update the information saved in the database. Again, we need to create a page in the frontend that has an HTML form. The difference here is that the input fields of the form should be filled by default with the data of the current user. So, let's start by adding a route handler for the /profile URL:
Route
.add('profile', function() {
if(userModel.isLogged()) {
var p = new Profile();
showPage(p);
} else {
Router.navigate('login');
}
})There is no reason to allow access to this page if the user is not logged in. A simple authentication check before calling the showPage helper forwards the user to the login page if needed.
The template that we need for the ...
Read now
Unlock full access