1
0
Fork 0

fix: enforce minimum length for auto-generated usernames

This commit is contained in:
Jonny 2026-07-16 08:48:51 +02:00
parent a6cbbbbc89
commit 0cce446e27
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ begin
base := lower(regexp_replace(r.name, '\s+', '.', 'g'));
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
base := substring(base from 1 for 30);
if base = '' then
if length(base) < 3 then
base := 'user' || substring(r.id::text from 1 for 8);
end if;
@ -60,7 +60,7 @@ begin
base := lower(regexp_replace(coalesce(new.raw_user_meta_data ->> 'name', new.email), '\s+', '.', 'g'));
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
base := substring(base from 1 for 30);
if base = '' then
if length(base) < 3 then
base := 'user' || substring(new.id::text from 1 for 8);
end if;