-
Notifications
You must be signed in to change notification settings - Fork 17
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
Added validation for the user update route/UI #646
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor immediate comments. Reviewing out of order as @jdbocarsly is going to also take a look at #627 first (which we will merge before this one).
Looks good so far, we can just discuss the right approach.
Although it seems a bit gross to have validation on both the client and server, I think it makes sense in this case since it really is easy to validate. One thing that might be missing is how the UI deals with a server-side validation, so you might want to test disabling the client side validation (e.g., making the display name max length on the client 151 and then providing a 151 char display name to the server to make sure that a nice error is returned).
1997bca
to
d1d41a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks Ben! Just one comment about the display name (below) and the suggestion that we should add a simple test that the validator does what we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BenjaminCharmes, this is looking good, just a few minor comments (of things we can think about in future PRs) and one that I think should be addressed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment here: https://github.com/the-grey-group/datalab/pull/646/files#r1539219700
I will remove some of the validation I asked for as we can never cover all cases, otherwise looks good!
if contact_email or contact_email in (None, ""): | ||
if contact_email == "": | ||
contact_email = None | ||
update["contact_email"] = EmailStr(contact_email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
is not a valid EmailStr
so we'll have to move that around a bit
Okay, running into a few issues (that it looks like I ran into last time I did this since an issue I opened myself 2 years ago was the first result when I googled...) Basically the custom types defined here either work in the pydantic model OR in the the type itself, but never in both. I've just updated them so that they work in both (by making them both constrained string types in pydantic and calling their validation methods on |
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
…splay_name Co-authored-by: Matthew Evans <[email protected]>
Removed unnecessary validator [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
Update front and back user's display_name validation [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
… of pydantic Display name updates in schema
Add test for display name with Chiense characters
8dff18d
to
1bc621d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, running into a few issues (that it looks like I ran into last time I did this since an issue I opened myself 2 years ago was the first result when I googled...)
Basically the custom types defined here either work in the pydantic model OR in the the type itself, but never in both. I've just updated them so that they work in both (by making them both constrained string types in pydantic and calling their validation methods on new).
Have just tidied these up with my additional commits, as well as adding some integration tests to check that things behave. Happy to merge this now but will try to preserve the commit history so you can see what I changed @BenjaminCharmes!
Nice work and thanks again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Tiny comment on one of the error messages.
Also, I'm noticing that when you are done with this modal and close it, the LoginDetails menu is still open. I think it would probably be more user friendly if it were closed, which you could do by changing line 28 in LoginDetails.vue to:
@click="editAccountSettingIsOpen = true; isUserDropdownVisible = false;"
Co-authored-by: Josh Bocarsly <[email protected]>
ab6386f
to
7699896
Compare
Linked to #640
Frontend:
Backend: