File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
examples/official-site/sqlpage/migrations Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ INSERT INTO component (name, description, icon, introduced_in_version)
2+ VALUES (
3+ ' redirect' ,
4+ ' Redirects the user to another page.
5+ This component is useful for implementing redirects after a form submission,
6+ or to redirect users to a login page if they are not logged in.
7+
8+ Contrary to the http_header component, this component completely stops the execution of the page after it is called,
9+ so it is suitable to use to hide sensitive information from users that are not logged in, for example.
10+
11+ Since it uses an HTTP header to redirect the user, it is not possible to use this component after the page has started being sent to the browser.' ,
12+ ' arrow-right' ,
13+ ' 0.7.2'
14+ );
15+ -- Insert the parameters for the http_header component into the parameter table
16+ INSERT INTO parameter (
17+ component,
18+ name,
19+ description,
20+ type,
21+ top_level,
22+ optional
23+ )
24+ VALUES (
25+ ' redirect' ,
26+ ' link' ,
27+ ' The URL to redirect the user to.' ,
28+ ' TEXT' ,
29+ TRUE,
30+ FALSE
31+ );
32+ -- Insert an example usage of the http_header component into the example table
33+ INSERT INTO example (component, description)
34+ VALUES (
35+ ' redirect' ,
36+ '
37+ Redirect an user to the login page if they are not logged in:
38+
39+ ```sql
40+ SELECT ' ' redirect' ' AS component, ' ' login.sql' ' AS link
41+ WHERE NOT EXISTS (SELECT 1 FROM login_session WHERE id = sqlpage.cookie(' ' session_id' ' ));
42+ ```
43+ '
44+ );
You can’t perform that action at this time.
0 commit comments