@@ -17,14 +17,40 @@ Stay tuned! We are on to something.
1717
1818## Creating users
1919
20- If you use a database, you'll have to create at least to save users. A
21- ` user ` table typically defines :
22- - a unique ID (the primary key)
20+ If you use a database, you'll have to create at least a ` users `
21+ table. It would typically define :
22+ - a unique ID (integer, primary key)
2323- a name (varchar)
2424- an email (varchar)
25- - a password (encrypted)
25+ - a password (varchar (and encrypted) )
2626- optionally, a key to the table listing roles.
2727
28+ You can start with this:
29+
30+ ~~~ SQL
31+ CREATE TABLE users (
32+ id INTEGER PRIMARY KEY ,
33+ username VARCHAR (255 ),
34+ email VARCHAR (255 ),
35+ password VARCHAR (255 ),
36+ )
37+ ~~~
38+
39+ You can run this right now with SQLite on the command line:
40+
41+ ```
42+ $ sqlite3 db.db "CREATE TABLE users (id INTEGER PRIMARY KEY, username VARCHAR(255), email VARCHAR(255), password VARCHAR(255))"
43+ ```
44+
45+ This creates the database if it doesn't exist. SQLite reads SQL from the command line.
46+
47+ Create users:
48+
49+ ```
50+ $ sqlite3 db.db "INSERT INTO users VALUES(1,'Alice','alice@mail','xxx');"
51+ ```
52+
53+ Did it work? Run ` SELECT * FROM users; ` .
2854
2955
3056## Encrypting passwords
@@ -42,10 +68,6 @@ If you use a database, you'll have to create at least to save users. A
4268;; nil
4369```
4470
45- You might also want to look at
46- [ hermetic] ( https://github.com/eudoxia0/hermetic ) , a simple
47- authentication system for Clack-based applications.
48-
4971### Manually (with Ironclad)
5072
5173In this recipe we do the encryption and verification ourselves. We use the de-facto standard
0 commit comments