Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New user account validations #2037

Merged

Conversation

shatfield4
Copy link
Collaborator

@shatfield4 shatfield4 commented Aug 3, 2024

Pull Request Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #1315

What is in this change?

  • On new user creation we now validate for usernames that are lowercase and have no spaces
  • Modified NewUserModal, EditUserModal, and AccountModal components for these validations
  • Frontend validation and User prisma model are updated for these validations
  • We do not validate the update function in the User model to prevent forcing users to have to change usernames when updating just their password
  • Still allow login with usernames that are not all lowercase and have spaces to prevent current users from getting locked out of their accounts

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

Copy link
Member

@timothycarambat timothycarambat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leverage HTML form sanitization where possible, validate this does not block existing usernames from forcing to be changed.

Do these rules also apply to API endpoints for users?

@shatfield4
Copy link
Collaborator Author

Updated backend validations to only validate the username with all lowercase and no spaces when calling the User.create() db model function.

@timothycarambat timothycarambat merged commit c970665 into master Aug 7, 2024
@timothycarambat timothycarambat deleted the 1315-feat-new-user-account-lowercase-and-spacing branch August 7, 2024 18:35
TuanBC pushed a commit to TuanBC/anything-llm that referenced this pull request Aug 26, 2024
* force lowercase and no space for new and
 edit user modals

* edit account modal validations

* use pattern for form validation + remove validations from edit user

* revert comment deletions

* comment fix

* update validation message

* update regex
allow updating by block name changes to invalid names

---------

Co-authored-by: timothycarambat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: New User account - lowercase and spacing
2 participants