Vibe.d tutorial
  • Build web apps with Vibe.d
  • Setting up
  • The default hello world app
  • Use your own HTML page
  • Serving other static files
  • Diet templates
  • More template pages
  • Use your own functions
  • Templates for ease of maintenance
  • Using include in templates
  • Responsive layout using CSS Grid
  • A fixed navbar and sticky footer
  • CSS modal dialogues
  • The web interface
  • Setting up MySQL server and tools
  • The schema
  • Setting up MySQL for Vibe.d
  • The EmployeeController class
  • The EmployeeModel class
  • A form for adding a new employee
  • Saving form data into the database
  • Testing the whole thing
  • Listing all the employees
  • Retrieving a record for editing
  • Saving form changes to the database
  • Deleting a record from the database
  • Finding an employee record by name
  • Displaying error messages with _error
  • Authentication and authorization
  • Logging in and authentication
  • Saving the login state to the session
  • Enforcing authorization through the session
  • Logging out
  • All the sources so far
  • A new project
    • The timekeeping system
Powered by GitBook
On this page

Logging out

Let’s just decide that if the user clicks on the Home link on the menu, the user is logged out.

Let’s edit the index() method then.

  void index(string _error = null)
  {
    m_user = User.init;
    terminateSession;
    string error = _error;
    render!("index.dt", error);
  }

Here, we re-initialized the m_user session variable then explicitly terminated the session before displaying the index.dt template page.

Compile, run, refresh the browser and test the app. You will see that when you click on the Home link, you have to log in again to see the other pages.

This effectively completes the employee system part.

PreviousEnforcing authorization through the sessionNextAll the sources so far

Last updated 2 years ago