The Trongate Administrators Module

This module provides functionality for managing administrators of the application. The controller class (Trongate_administrators.php) handles admin login, admin user management, and admin authentication-related tasks.

make_sure_allowed()

Ensures that access is allowed for administrators by verifying the presence of a valid token. If the user is not logged in or lacks the required token, they are redirected to the Trongate administrators' login page.

account()

Redirects to the 'create' route for the Trongate administrators module based on the user's token. If a valid 'Trongate token' is authenticated, the method constructs a redirect URL to the 'create' route with the user's ID appended.

conf_delete()

Manages the confirmation process for deleting a Trongate administrator record. Validates the deletion request and loads the confirmation template if the record exists. Redirects to the (admin) management page if the record doesn't exist.

create()

Renders a page for the creation or updating of Trongate administrator records.

go_home()

Redirects to the designated dashboard home page.

login()

Renders a login page for administrators.

login_check()

Validates the submitted username and password for login authentication against existing usernames and hashed passwords stored in the 'trongate_administrators' table.

logout()

Handles user logout by destroying tokens and redirects based on the existence of the secret login segment.

manage()

Renders a page for the management of records within the 'trongate_administrators' table. Retrieves necessary data such as admin ID, username rows from the model, and loads the management view.

submit()

Handles form submission for user data, validates input, updates existing records, or creates new ones accordingly. Redirects to management view or the creation form based on form submission.

submit_delete()

Handles the deletion of a specific user record and related entries based on the given update ID. Performs the deletion of related records from 'trongate_users' and 'trongate_administrators' tables. Redirects to the management page after successful deletion.

submit_login()

Handles the submission of login forms, validating user input and logging users in if validation passes. Redirects to the login form on validation failure or to the base URL on 'Cancel' submission.

username_check()

Checks the availability of a username and validates it against existing usernames in the 'trongate_administrators' table.