Commit graph

9 commits

Author SHA1 Message Date
Kumi 2c976a9c03
fix: optimize email validation in forms
Refactored the email lookup logic in the EmailForm class to fetch all users once and then search the list in Python, rather than making a database call for each email validation. This change reduces database load and potentially speeds up form processing by avoiding multiple queries. It's particularly beneficial when dealing with a large number of users, ensuring scalability and improved performance of the application.

The new approach retrieves the list of users upfront and iterates over it to find a match, falling back to `None` if no user with the specified email exists. This method is more efficient and aligns with best practices for handling database interactions in a web application.
2024-04-26 12:19:16 +02:00
Kumi aa4065e219
feat: add email validation to form
Introduce a new custom validator within the EmailForm class to prevent duplicate email usage both in the local database and on the Planka platform. This validator checks if the submitted email is already present in the local `requests` table and then queries the Planka user management to ensure the email is not associated with an existing Planka user. If a duplicate is found in either case, it raises a ValidationError, effectively blocking the reuse of email addresses and facilitating a more secure and reliable user registration process.

Resolves issue with duplicate email registrations, enhancing data integrity and user experience.
2024-04-26 11:56:11 +02:00
Kumi debb69e112
fix: adjust proxy settings for accurate IP resolution
Adjusted the ProxyFix configuration to include the `x_for=1` parameter, ensuring accurate client IP resolution by considering X-Forwarded-For headers. This change addresses issues encountered with IP detection behind proxies, thus enhancing the app's reliability in environments where reverse proxies are used.
2024-04-26 09:52:50 +02:00
Kumi 89825cf85c
feat: Enhance app config and user feedback
Introduced changes to `app.py` and templates to enhance application configuration options, improve user feedback mechanisms, and bolster security practices. Key updates include:

- Expanded Flask's configuration based on `settings.ini`, enabling `debug` mode and applying `ProxyFix` middleware conditionally to support reverse proxy setups.
- Extended the functionality to include dynamic footer links, sourced from the configuration file, across all relevant templates. This contributes to a more dynamic and maintainable web interface.
- Adjusted the rate limiting functionality from a 1-hour to a 1-day window, offering a more lenient and user-friendly request limitation system.
- Implemented an error handling flow for user creation in Planka, providing clearer feedback when password requirements are not met, thus enhancing the user signup experience.
- Added a new cron route for cleaning up stale requests from the database, aligning data retention practices with privacy concerns.

These changes aim to provide a more configurable, user-friendly, and secure application, addressing feedback and evolving requirements.
2024-04-26 09:45:43 +02:00
Kumi 79e83aa0a7
feat: enhance user registration flow with validation
This update vastly improves the user experience for registration and email confirmation processes within the app. By integrating Flask-WTF, the commit introduces form handling with enhanced data validation and user feedback. It also refactors the SMTP configuration to utilize dynamic sender selection and improves the handling of SSL settings, ensuring a more reliable email delivery setup.

To provide better security and a smoother user interface, we've implemented CSRF protection with FlaskForm and utilized WTForms for input fields, applying validators to ensure data integrity. The introduction of user existence checks before registration helps prevent duplicate usernames in the system, contributing to a cleaner and more manageable user database.

Email composition in the send_email function has been streamlined for readability, and several new templates were added to provide users with clear instructions after submitting requests or completing registration, enhancing overall usability.

By addressing these areas, the commit not only elevates the security posture of the application but also significantly enriches the user interaction, making the system more robust and user-friendly.

Relevant configurations for SMTP and system random secret key generation have been adjusted for better compliance and security standards.

Additionally, unnecessary scripts and redundant code blocks were removed for a cleaner code base, and CSS adjustments were made for improved form presentation and application aesthetics.

Overall, this comprehensive update lays a stronger foundation for user management and interaction within the application, setting the stage for future enhancements and a better end-user experience.
2024-04-26 08:53:28 +02:00
Kumi 22c74a489e
feat: enhance user feedback for duplicate requests
Improved the feedback mechanism for users who attempt to submit a duplicate request by providing a more detailed already_requested.html template. This update includes dynamic display of the application's name, and custom title and subtitle information to guide users more clearly on what steps to follow next. Additionally, refined the HTML structure of base and request templates for better readability and user guidance, including a new privacy notice for email submissions.

- The already_requested.html page now dynamically includes the app name, and specific titles and subtitles to better inform users about their duplicate request status.
- Enhanced the base.html template for consistency in HTML syntax and added clearer structural divisions for main content areas.
- Updated the request.html template to include a privacy notice detailing how the user's information will be used, aiming to increase transparency and trust.

These changes aim to make the user's experience smoother and more informative, especially in cases where duplicate requests might cause confusion.
2024-04-25 20:57:19 +02:00
Kumi a60b74b16f
feat(footer): add Git repository link to footer
Enhanced the site footer in `base.html` by including a direct link to the project's Git repository, improving accessibility and visibility for users interested in the codebase or contributing. Also, updated the registration form in `request.html` to use POST method, enhancing security and data integrity during user registration.
2024-04-25 20:35:41 +02:00
Kumi 42baa98cb9
feat: enhance user request flow with styled form
Updated the `request.html` page to include a more user-friendly form, prompting users for their email to request a Planka account. The accompanying `style.css` was enriched with styles for inputs and buttons, ensuring a coherent and accessible design. This change aims to streamline the account request process, improving user experience by guiding them through an intuitive email verification system. Enhanced styling for focus and hover states also improves accessibility and user interaction cues.
2024-04-25 20:25:47 +02:00
Kumi 9e5f237b6f
feat: Initialize application with Flask framework
Implemented the foundation of a Flask application designed to manage email requests with rate limiting and SQLite database integration. This includes setting up basic app infrastructure, such as Flask app initialization, database creation with email request tracking, SMTP configuration for email sending, and rate limiting based on IP addresses to prevent abuse. Additionally, the commit introduces the core frontend structure along with styling, utilizing templates for basic request handling and display. The `.gitignore` file was also set up to ignore common Python and development artifacts. Relevant dependencies required for the application are outlined in `requirements.txt`.

This setup lays the groundwork for future expansions, including more detailed request handling, user authentication, and enhanced security features.

No specific issues are addressed in this commit; it represents the initial application setup and starting point for further development.
2024-04-25 10:26:11 +02:00