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

Check Team and Project Name Validity in Frontend #2591

Closed
fm3 opened this issue May 11, 2018 · 7 comments · Fixed by #3034
Closed

Check Team and Project Name Validity in Frontend #2591

fm3 opened this issue May 11, 2018 · 7 comments · Fixed by #3034
Assignees
Milestone

Comments

@fm3
Copy link
Member

fm3 commented May 11, 2018

for example team names and emails have regex checks in the db schema. it would be useful to ensure this is all also checked in the frontend

Log Time

@hotzenklotz
Copy link
Member

Which schema properties are you referring to? The frontend already validates emails, the length of certain fields etc.

@fm3
Copy link
Member Author

fm3 commented May 11, 2018

right, I did not go through the list, turns out to be very small. I noticed this for team names ( https://github.com/scalableminds/webknossos/blob/master/tools/postgres/schema.sql#L174 )

@fm3 fm3 changed the title frontend checks for name restriction regexes Check Team Name Validity in Frontend May 11, 2018
@philippotto philippotto changed the title Check Team Name Validity in Frontend Check Team and Project Name Validity in Frontend Aug 10, 2018
@philippotto
Copy link
Member

The same issue exists for project names (e.g., must not contain spaces). I changed the scope of the issue. So please tackle that, too, @MichaelBuessemeyer :)

@MichaelBuessemeyer
Copy link
Contributor

@philippotto Actually this is already handled in the project-create-view (

).
I could not find any other possibility to change the name a project.

@philippotto
Copy link
Member

The referenced code only checks for a minimum length. But it does not ensure that the name doesn't contain spaces, which seems to be a constraint (at least, I cannot create a project when the name contains spaces). However, I'm a bit confused since the mh lab wk instance has projects with spaces in it.

@fm3 Does the backend forbid spaces in names? The regex doesn't look like that, but I'm not sure whether there's some other magic which ensures this constraint: name VARCHAR(256) NOT NULL CHECK (name ~* '^.{3,}$'),

@fm3
Copy link
Member Author

fm3 commented Aug 13, 2018

@philippotto @MichaelBuessemeyer Correct, the database has a weaker check, to still allow the legacy names. However, when creating new projects, the name must also pass the stricter check in

private val validateProjectName = Reads.pattern("^[a-zA-Z0-9_-]*$".r, "project.name.invalidChars")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants