Web Application (app)¶
This package contains all the Flask Blueprints that define the application’s routes and views. It serves as the primary interface for user interaction.
Authentication Blueprint¶
Forms¶
- class kusibot.app.auth.forms.LoginForm(*args, **kwargs)[source]¶
Login form for user authentication.
This form is used in the login view to collect and validate user credentials. It includes fields for an identifier (username or email), a password, an option to remember the session, and a submit button.
- identifier¶
A required text field for the user’s username or email. Validates for a length between 4 and 64 characters.
- Type:
StringField
- password¶
A required password field. Validates for a length between 8 and 64 characters.
- Type:
PasswordField
- remember¶
An optional checkbox to enable a persistent user session.
- Type:
BooleanField
- submit¶
The form submission button.
- Type:
SubmitField
- class kusibot.app.auth.forms.RegisterForm(*args, **kwargs)[source]¶
Registration form for new user creation.
This form is used in the registration view to collect and validate information for a new standard user account. It includes fields for username, email, and password, with strong password validation and confirmation. Custom validators are used to check for the uniqueness of the username and email against the database.
- username¶
A required text field for the new user’s username. Validates for a length between 4 and 20 characters.
- Type:
StringField
- email¶
A required text field for the user’s email address. Validates for a valid email format.
- Type:
StringField
- password¶
A required password field with complex validation rules, including length, and the required presence of uppercase, lowercase, numeric, and special characters.
- Type:
PasswordField
- confirm_password¶
A required password confirmation field that must be equal to the password field.
- Type:
PasswordField
- submit¶
The form submission button.
- Type:
SubmitField
Routes¶
- kusibot.app.auth.routes.login()[source]¶
Login route for KusiBot. Accepts the following methods: - GET: Goes to principal page if authenticated, else, goes to Login Page. - POST: Log in a user to Kusibot given its username and password.
- Returns:
A redirect response or the HTML login form to render.
- Return type:
(Response | str)
- kusibot.app.auth.routes.logout()[source]¶
Logs out an authenticated user from KusiBot. Accepts the following methods: - GET: Logs out, ends any current conversation and returns to Main Page.
- Returns:
A redirect response to the main page.
- Return type:
Response
- kusibot.app.auth.routes.signup()[source]¶
Register route for KusiBot. Accepts the following methods: - GET: Goes to principal page if authenticated, else, goes to Register Page. - POST: Register a new user in KusiBot.
- Returns:
A redirect response or the HTML register form to render.
- Return type:
(Response | str)
Utils¶
- kusibot.app.auth.utils.professional_user_required(f)[source]¶
A decorator function to ensure professional users have access to the allowed views. If user is not professional, it aborts with a 403 Forbidden error.
- kusibot.app.auth.utils.redirect_to_principal_page(is_professional)[source]¶
Redirects the authenticated current user to its corresponding principal page.
USER: Goes to /chatbot
PROFESSIONAL: Goes to /internal/dashboard
- Parameters:
is_professional (bool) – Indicates if the user is a professional or not.
- Returns:
Redirect response to the user’s principal page.
- Return type:
Response
Chatbot Blueprint¶
Routes¶
Dashboard Blueprint¶
Routes¶
- kusibot.app.dashboard.routes.dashboard()[source]¶
Render the dashboard page (protected) with the list of users using KusiBot.
- Returns:
The HTML dashboard page to render.
- Return type:
str
- kusibot.app.dashboard.routes.dashboard_assessments()[source]¶
Get the assessments for a selected user (URL parameter).
- Returns:
The JSON assessments for the given user.
- Return type:
Response
General Blueprint¶
Routes¶
- kusibot.app.general.routes.about()[source]¶
Render the about page.
- Returns:
The HTML about page to render.
- Return type:
str
- kusibot.app.general.routes.help()[source]¶
Render the help page.
- Returns:
The HTML help page to render.
- Return type:
str