forked from fahrPool/fahrPool
fix: enforce minimum length for auto-generated usernames
This commit is contained in:
parent
a6cbbbbc89
commit
0cce446e27
|
|
@ -21,7 +21,7 @@ begin
|
||||||
base := lower(regexp_replace(r.name, '\s+', '.', 'g'));
|
base := lower(regexp_replace(r.name, '\s+', '.', 'g'));
|
||||||
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
|
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
|
||||||
base := substring(base from 1 for 30);
|
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);
|
base := 'user' || substring(r.id::text from 1 for 8);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ begin
|
||||||
base := lower(regexp_replace(coalesce(new.raw_user_meta_data ->> 'name', new.email), '\s+', '.', 'g'));
|
base := lower(regexp_replace(coalesce(new.raw_user_meta_data ->> 'name', new.email), '\s+', '.', 'g'));
|
||||||
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
|
base := regexp_replace(base, '[^a-z0-9._-]', '', 'g');
|
||||||
base := substring(base from 1 for 30);
|
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);
|
base := 'user' || substring(new.id::text from 1 for 8);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue