graphile / starter

Opinionated SaaS quick-start with pre-built user account and organization system for full-stack application development in React, Node.js, GraphQL and PostgreSQL. Powered by PostGraphile, TypeScript, Apollo Client, Graphile Worker, Graphile Migrate, GraphQL Code Generator, Ant Design and Next.js
https://graphile-starter.herokuapp.com
Other
1.75k stars 220 forks source link

Fix username validation #227

Closed benjie closed 3 years ago

benjie commented 3 years ago

Description

Fixes #226; regexp was wrong.

To apply this to your previous starter DB; add a migration such as:

alter table app_public.users drop constraint users_username_check;

-- BEWARE: this is technically a breaking change, previous usernames that had a
-- trailing underscore will no longer be allowed (e.g. `AB_`). This may prevent
-- migration.
alter table app_public.users add constraint users_username_check check(length(username) >= 2 and length(username) <= 24 and username ~ '^[a-zA-Z]([_]?[a-zA-Z0-9])+$');

Performance impact

None.

Security impact

None.