Commit graph

4,677 commits

Author SHA1 Message Date
igorrCarvalho
4739372e20 Refactor: Add trim() to signUp page 2023-08-30 17:40:18 -03:00
igorrCarvalho
35e24610af Refactor: Add trim() to login form 2023-08-30 17:29:00 -03:00
anovazzi1
c64594c0a8 removed dead code 2023-08-29 22:33:19 -03:00
anovazzi1
6457725d13 fix(genericModal/index.tsx): remove debugger statement for cleaner code
fix(genericModal/index.tsx): update condition for setting nodeClass to avoid unnecessary re-rendering
2023-08-29 22:29:41 -03:00
Cristhian Zanforlin Lousa
f86c7c1689 🐛 fix(genericModal/index.tsx): add conditional check before setting nodeClass to prevent potential null or undefined value 2023-08-29 22:13:28 -03:00
Cristhian Zanforlin Lousa
89a0918dc5 🔧 fix(codeTabsComponent): remove unused useContext for isTweakPage in codeTabsComponent
🔧 fix(alertContext): remove isTweakPage and setIsTweakPage from alertContext

🔧 fix(genericModal): add null check for nodeClass before calling postValidatePrompt

🔧 fix(extraSidebarComponent): remove setIsTweakPage from extraSidebarComponent

🔧 fix(typesContext): remove isTweakPage and setIsTweakPage from typesContext
2023-08-29 22:07:18 -03:00
anovazzi1
8a772086e2 fix(api): make frontend_node field optional in ValidatePromptRequest to allow for a tweak call without a frontend_node
fix(api): handle case where frontend_node is None in post_validate_prompt to avoid attempting to update a non-existent node
2023-08-29 22:03:54 -03:00
anovazzi1
02cc23d6b1
Login (#802)
### Description
This pull request introduces a significant enhancement to the project by
incorporating robust authentication logic. The enhancement addresses the
critical need for secure user access and data protection within the
application. With this addition, the system will be able to authenticate
users, verify their identities, and provide access only to authorized
individuals.

### Changes Implemented
- **Authentication Middleware**: A new middleware module has been
implemented to intercept incoming requests and validate user
authentication. This middleware checks for valid authentication tokens
or credentials and ensures that only authenticated users can access
protected resources.

- **User Authentication Endpoint**: A new endpoint has been created to
handle user authentication. This endpoint allows users to provide their
credentials, which are then securely processed and validated against the
stored user data.

- **Password Hashing**: User passwords are now securely hashed using a
strong cryptographic algorithm before being stored in the database. This
ensures that even if the database is compromised, user passwords remain
inaccessible.

- **Token-Based Authentication**: Upon successful authentication, the
system generates a time-limited access token for the user. This token
must be included in subsequent requests to access protected resources.
Token validity is maintained through token expiration and refresh
mechanisms.

- **Authorization Checks**: The logic has been extended to include
authorization checks after successful authentication. This ensures that
authenticated users only have access to the resources they are
authorized to use, based on their roles and permissions.

### Benefits
1. **Enhanced Security**: By implementing strong authentication
mechanisms and password hashing, the project significantly improves
security, minimizing the risk of unauthorized access or data breaches.

2. **User-Friendly Experience**: Users can securely access the
application, confident in the knowledge that their credentials and data
are protected. The token-based authentication simplifies the user
experience by eliminating the need for frequent re-authentication.

3. **Scalability**: The authentication logic has been designed with
scalability in mind, ensuring that the system can handle a growing
number of users and requests without compromising security or
performance.

4. **Modularity**: The new authentication logic has been integrated as a
separate module, enhancing the project's modularity and maintainability.
2023-08-29 17:38:20 -03:00
anovazzi1
cf8df6c62b fix(users.py): update error message to be more generic and not reveal specific reason for username unavailability
fix(AdminPage/index.tsx): fix nullish assertion for create_at and updated_at properties to avoid potential errors
fix(signUpPage/index.tsx): fix error handling to correctly display error message
fix(types/components/index.ts): make id, create_at, and updated_at properties optional in UserInputType
2023-08-29 16:44:15 -03:00
anovazzi1
d73b3b0b52 fix(users.py): improve error message when trying to add a user with an already claimed username 2023-08-29 16:26:15 -03:00
Lucas Oliveira
2cfd772387 React Flow update and minor style fixes 2023-08-29 15:42:30 -03:00
Cristhian Zanforlin Lousa
27455cbd77 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-29 11:46:52 -03:00
Cristhian Zanforlin Lousa
3e55e5f394 🐛 fix(headerComponent): change Sign out button to anchor tag for better accessibility and consistency
 feat(headerComponent): add Home link when on admin page for easier navigation
 feat(headerComponent): add Admin page link for easier navigation to admin page
🐛 fix(ApiKeysPage): handle case when api_keys.name is null or undefined by displaying "-" instead
🐛 fix(ApiKeysPage): handle case when api_keys.last_used_at is an invalid date by displaying "Never" instead
 feat(ApiKeysPage): add Total Uses column to display the total number of uses for each API key
🐛 fix(loginPage): set isAdmin context variable based on user's is_superuser property
🐛 fix(loginPage): increase delay before fetching logged user to 500ms for better user experience
🐛 fix(types): add total_uses property to ApiKey type to match backend response
2023-08-29 11:46:48 -03:00
Gabriel Luiz Freitas Almeida
8c77613f72 🔀 refactor(utils.py): change return type annotation of authenticate_user function from Union[User, None] to Optional[User] for clarity and consistency 2023-08-29 10:45:10 -03:00
Gabriel Luiz Freitas Almeida
408caea750 🔒 chore(api.tsx): refactor request interceptor logic to improve readability and maintainability 2023-08-29 10:40:09 -03:00
igorrCarvalho
787c7844f5 Merge login into login 2023-08-28 20:44:05 -03:00
igorrCarvalho
5b75d44c3e Fix: remove admin page and signout on flow page 2023-08-28 20:41:54 -03:00
anovazzi1
166cd7e9f0 added flex to avoid scroll bug on admin page 2023-08-28 20:33:39 -03:00
anovazzi1
bf81507447 feat(AdminPage): add support for displaying user ID, creation date, and update date in the user table
fix(AdminPage): add type annotations to user variables in filter and map functions to improve type safety
2023-08-28 20:07:52 -03:00
igorrCarvalho
21ef1b43c7 fix: Remove redundant button on admin page header 2023-08-28 20:04:56 -03:00
igorrCarvalho
bb4ed111ef fix: Remove redundant button on admin page header 2023-08-28 19:58:25 -03:00
anovazzi1
d1ffe5ab11 fix glitch on apiKey page 2023-08-28 18:59:59 -03:00
Cristhian Zanforlin Lousa
6c03edc50a 🐛 fix(auth.py): set AUTO_LOGIN to False to disable automatic login as a super user
🐛 fix(API/index.ts): add null check for response object before checking status to prevent potential error
2023-08-28 18:22:59 -03:00
Gabriel Luiz Freitas Almeida
acd661f629 🔧 chore(__main__.py): remove unused imports and functions to improve code cleanliness and maintainability
🔧 chore(main.py): update import statement to use get_number_of_workers from __main__ module
🔧 chore(util.py): remove unused imports and functions to improve code cleanliness and maintainability
2023-08-28 18:09:26 -03:00
Gabriel Luiz Freitas Almeida
9804d58d32 🐛 fix(base.py): add *args and **kwargs to build method in Vertex class to allow for additional arguments to be passed
🐛 fix(types.py): add *args and **kwargs to build method in AgentVertex, LLMVertex, WrapperVertex, ChainVertex, and PromptVertex classes to allow for additional arguments to be passed
🐛 fix(utils.py): change return type annotation in api_key_security function from Optional[ApiKey] to Optional[User] to reflect the actual return type
2023-08-28 18:05:43 -03:00
Gabriel Luiz Freitas Almeida
23651e3a45 🔧 chore(Makefile): exclude .venv directory from mypy type checking to improve performance and avoid unnecessary errors 2023-08-28 18:05:29 -03:00
Cristhian Zanforlin Lousa
aba898adf7 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-28 17:56:56 -03:00
Gabriel Luiz Freitas Almeida
099921514c 🐛 fix(endpoints.py): add missing colon after if statement condition to fix syntax error
🔒 chore(endpoints.py): fix indentation and add missing colon after if statement condition for better code readability
2023-08-28 17:56:40 -03:00
Gabriel Luiz Freitas Almeida
1b79c1bd7e 🐛 fix(types.py): pass user_id parameter to build methods in AgentVertex, LLMVertex, WrapperVertex, ChainVertex, and PromptVertex to enable user-specific functionality 2023-08-28 17:56:39 -03:00
Gabriel Luiz Freitas Almeida
ac6d2ff8b4 🔥 refactor(service.py): remove unused import and commented code in AuthManager class 2023-08-28 17:56:38 -03:00
Gabriel Luiz Freitas Almeida
31abe8d67e 🐛 fix(utils.py): fix missing return statement in api_key_security function
🔀 refactor(utils.py): refactor create_super_user function to use Optional types for username and password parameters
2023-08-28 17:56:38 -03:00
Gabriel Luiz Freitas Almeida
d9deb6fd5f 🔧 chore(util.py): add type ignore comment to import statement for multiprocess module
🐛 fix(util.py): fix condition to check if "BaseModel" is in the string representation of _type to avoid skipping BaseModel types in format_dict function
2023-08-28 17:56:37 -03:00
Gabriel Luiz Freitas Almeida
2edffd33ee 🐛 fix(endpoints.py): add missing colon after if statement condition
🔒 chore(endpoints.py): rename api_key parameter to api_key_user for clarity and consistency
🔒 chore(endpoints.py): add type hint for api_key_user parameter to indicate it is of type User
🔒 chore(endpoints.py): remove unnecessary assignment of api_key_user from api_key.user
2023-08-28 17:56:36 -03:00
Cristhian Zanforlin Lousa
7dcb534eb3 Merge branch 'login' of https://github.com/logspace-ai/langflow into login 2023-08-28 17:56:28 -03:00
Cristhian Zanforlin Lousa
0a2ced4e60 🔧 fix(authContext.tsx): remove unused refreshAccessToken function to improve code readability and maintainability
🔧 fix(tabsContext.tsx): remove unnecessary console.error statements to improve code readability and maintainability
🔧 fix(genericModal/index.tsx): remove unnecessary console.log statement to improve code readability and maintainability
🔧 fix(ApiKeysPage/index.tsx): remove unnecessary console.log statement to improve code readability and maintainability
🔧 fix(auth.ts): remove unused refreshAccessToken function type to improve code readability and maintainability
2023-08-28 17:56:24 -03:00
Gabriel Luiz Freitas Almeida
c9fef26981
Merge branch 'dev' into login 2023-08-28 20:34:08 +00:00
igorrCarvalho
70a8b1f630 Fix: Admin Page button showing even when logged as normal user 2023-08-28 17:28:32 -03:00
igorrCarvalho
97aa1e1443 Fix: Remove processCode() for when popUp open and make it only happen when click Check and save 2023-08-28 17:15:58 -03:00
Gabriel Luiz Freitas Almeida
a154955154 🔧 fix(__main__.py): import display_results function from utils.util to fix NameError
 feat(__main__.py): add migration command to run database migrations with an option to run in test mode
🔧 fix(util.py): import console from __main__ module to fix NameError
 feat(util.py): add display_results function to display migration results in a table format
2023-08-28 16:22:56 -03:00
Gabriel Luiz Freitas Almeida
5f2a949ec5 🔧 fix(manager.py): import missing dependencies to resolve NameError and improve code readability
 feat(manager.py): add method run_migrations_test() to check if all models are in the database and up to date with all columns
 feat(manager.py): add method check_table() to check if a table exists and if all expected columns are present
🔧 fix(utils.py): import missing dependencies to resolve NameError and improve code readability
 feat(utils.py): add dataclasses Result and TableResults to store check results for tables and columns
2023-08-28 16:22:55 -03:00
Gabriel Luiz Freitas Almeida
bdd04004b3 🔀 chore(utils.py): add type hints to the get_db_manager() function for better code readability and maintainability 2023-08-28 16:22:54 -03:00
igorrCarvalho
2b88963e64 refactor: bring back border to the login related buttons 2023-08-28 16:20:19 -03:00
igorrCarvalho
8f90e61379 Refactor: update Last Used from invalid date to never 2023-08-28 16:07:57 -03:00
Gabriel Luiz Freitas Almeida
137954de6b 🐛 fix(__main__.py): rename serve command to run command for better semantics and clarity
🔧 chore(test_cli.py): update test to use the new run command instead of serve command
 feat(test_cli.py): add test for creating a superuser with the superuser command
2023-08-28 15:47:57 -03:00
Gabriel Luiz Freitas Almeida
ecf54acb7c 🔧 fix(adds_tables.py): set default values for 'total_uses' and 'is_active' columns to improve data consistency and simplify code 2023-08-28 15:30:42 -03:00
Gabriel Luiz Freitas Almeida
9604ace084 🔥 chore(adds_tables.py): remove 'flowstyle' table and related indices if it exists during upgrade to ensure data consistency
🔥 chore(adds_tables.py): remove 'flowstyle' table and related indices if it exists during downgrade to ensure data consistency
2023-08-28 14:45:30 -03:00
Gabriel Luiz Freitas Almeida
4320b127d3 🐛 fix(utils.py): handle exception when running migrations to ignore "already exists" error and prevent unnecessary error logging and raising of RuntimeError 2023-08-28 14:43:58 -03:00
igorrCarvalho
cb3fc079c6 refactor: Migrate api key messages to constants 2023-08-28 14:06:22 -03:00
Gabriel Luiz Freitas Almeida
58317a3891 🔧 chore(adds_tables.py): add comment explaining the reason for dropping '_alembic_tmp_flow' table before creating indices 2023-08-28 11:54:13 -03:00
Gabriel Luiz Freitas Almeida
49d6054517 🔧 fix(adds_tables.py): fix foreign key creation for 'flow' table when 'user' table exists
 feat(adds_tables.py): add support for creating 'user_id' column in 'flow' table if it does not exist
🔧 fix(adds_tables.py): fix index creation for 'flow' table when 'user_id' column exists
2023-08-28 11:53:24 -03:00