Logout
Function: Logout
This function allows you to securely log out the current user from your application. After logging out, the user will be redirected to either the application's homepage, the login page, or a specific page you define. This is useful for ensuring user privacy and managing session access.
Input
- Redirect to page: (Optional) Choose a specific page within your application to redirect the user to after they have successfully logged out. If you leave this empty, the user will be automatically sent to the application's default homepage or login screen.
Execution Flow
Real-Life Examples
Example 1: Simple Logout
A user wants to log out of the application and return to the default login page.
- Inputs:
- Redirect to page: (Left empty)
- Result: The current user is logged out, and the application automatically redirects them to the default login page.
Example 2: Logout and Redirect to a "Thank You" Page
After completing a survey, a user logs out and is directed to a custom "Thank You" page.
- Inputs:
- Redirect to page:
ThankYouPage(assumingThankYouPageis a page you've created in your application)
- Redirect to page:
- Result: The current user is logged out, and the application redirects them to the
ThankYouPage.
Example 3: Logout for Session Management
An administrator wants to provide a "Log Out" button that always returns users to the main dashboard after logging out, regardless of where they were previously.
- Inputs:
- Redirect to page:
Dashboard(assumingDashboardis the main dashboard page in your application)
- Redirect to page:
- Result: The current user is logged out, and the application redirects them to the
Dashboardpage.