Skip to content

Commit 5ee781c

Browse files
committed
use the login component in the user auth example
1 parent d542a8a commit 5ee781c

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

examples/user-authentication/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
services:
22
web:
33
image: lovasoa/sqlpage:main # main is cutting edge, use sqlpage/SQLPage:latest for the latest stable version
4+
build:
5+
context: ".."
46
ports:
57
- "8080:8080"
68
volumes:
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
SELECT 'form' AS component,
1+
SELECT 'login' AS component,
2+
'login.sql' AS action,
23
'Sign in' AS title,
3-
'Sign in' AS validate,
4-
'login.sql' AS action;
5-
6-
SELECT 'username' AS name;
7-
SELECT 'password' AS name, 'password' AS type;
8-
9-
SELECT 'alert' as component,
10-
'Sorry' as title,
11-
'We could not authenticate you. Please log in or [create an account](signup.sql).' as description_md,
12-
'alert-circle' as icon,
13-
'red' as color
14-
WHERE $error IS NOT NULL;
4+
'Username' AS username,
5+
'Password' AS password,
6+
'user' AS username_icon,
7+
'lock' AS password_icon,
8+
case when $error is not null then 'We could not authenticate you. Please log in or [create an account](signup.sql).' end as error_message_md,
9+
'Sign in' AS validate;

sqlpage/templates/login.handlebars

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
{{#if title}}
2121
<h1 class="text-center mb-3">{{title}}</h1>
2222
{{/if}}
23-
{{#if error_message}}
23+
{{#if (or error_message error_message_md)}}
2424
<div class="alert alert-danger mb-3" role="alert">
2525
<div class="alert-icon">
2626
{{icon_img 'alert-circle'}}
2727
</div>
28-
<div class="overflow-auto w-100">
29-
{{error_message}}
28+
<div class="overflow-auto w-100 remove-bottom-margin">
29+
{{~error_message~}}
30+
{{{~markdown error_message_md~}}}
3031
</div>
3132
</div>
3233
{{/if}}

0 commit comments

Comments
 (0)