Skip to content

Commit c0a1911

Browse files
committed
add an explanation about the logged_in_user function
Hopefully it prevents users from introducing security vulnerabilities in their websites
1 parent 8d3c8dc commit c0a1911

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/user-authentication/protected_page.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
SELECT 'redirect' AS component,
22
'signin.sql?error' AS link
33
WHERE logged_in_user(sqlpage.cookie('session')) IS NULL;
4+
-- logged_in_user is a custom postgres function defined in the first migration of this example
5+
-- that avoids having to repeat `(SELECT username FROM login_session WHERE id = session_id)` everywhere.
46

57
SELECT 'shell' AS component, 'Protected page' AS title, 'lock' AS icon, '/' AS link, 'logout' AS menu_item;
68

0 commit comments

Comments
 (0)