loginUserId parameter in _GET or _POST for direct login without username and password. This can be secured by: - must login after x days from set loginUserId on - can only login with loginUserId in given time range - flag lock loginUserId
16 lines
289 B
PL/PgSQL
16 lines
289 B
PL/PgSQL
-- adds the created or updated date tags
|
|
|
|
CREATE OR REPLACE FUNCTION set_uid()
|
|
RETURNS TRIGGER AS
|
|
$$
|
|
DECLARE
|
|
random_length INT = 32; -- that should be long enough
|
|
BEGIN
|
|
IF TG_OP = 'INSERT' THEN
|
|
NEW.uid := random_string(random_length);
|
|
END IF;
|
|
RETURN NEW;
|
|
END;
|
|
$$
|
|
LANGUAGE 'plpgsql';
|