fix: preserve week-long sessions and add profile mascot
This commit is contained in:
1 parent
4e71e9b797
commit
40f24cf5f7
18 files changed
+240
-25
No files matched your search
@@ -0,0 +1,13 @@
|
||||
do $migration$
|
||||
declare
|
||||
definition text;
|
||||
old_block text := E' else\n update auth.users\n set encrypted_password = extensions.crypt(v_pw, extensions.gen_salt(''bf'')),\n updated_at = now()\n where id = v_uid;\n delete from auth.sessions where user_id = v_uid;\n end if;';
|
||||
new_block text := E' else\n perform 1 from auth.users where id = v_uid for update;\n if exists (\n select 1 from auth.users\n where id = v_uid\n and encrypted_password is distinct from extensions.crypt(v_pw, encrypted_password)\n ) then\n update auth.users\n set encrypted_password = extensions.crypt(v_pw, extensions.gen_salt(''bf'')),\n updated_at = now()\n where id = v_uid;\n delete from auth.sessions where user_id = v_uid;\n end if;\n end if;';
|
||||
begin
|
||||
select pg_get_functiondef('public._ensure_auth_user(text,text,text)'::regprocedure) into definition;
|
||||
if strpos(definition, old_block) = 0 then
|
||||
raise exception 'Unexpected _ensure_auth_user password update block';
|
||||
end if;
|
||||
execute replace(definition, old_block, new_block);
|
||||
end;
|
||||
$migration$;
|
||||
Reference in new issue
Block a user