docs/examples/users.md: pgcrypto includes uuidv4 generation

No need to use the uuid-ossp extension
This commit is contained in:
daurnimator
2016-01-08 13:20:57 +11:00
parent 92df3d3243
commit 96533fa2fe
+3 -5
View File
@@ -28,13 +28,11 @@ value.
### Storing Users and Passwords ### Storing Users and Passwords
We create a database schema especially for auth information. We'll We create a database schema especially for auth information. We'll
also need the postgres extensions also need the postgres extension
[pgcrypto](http://www.postgresql.org/docs/current/static/pgcrypto.html) and [pgcrypto](http://www.postgresql.org/docs/current/static/pgcrypto.html).
[uuid-ossp](http://www.postgresql.org/docs/current/static/uuid-ossp.html).
```sql ```sql
create extension if not exists pgcrypto; create extension if not exists pgcrypto;
create extension if not exists "uuid-ossp";
-- We put things inside the basic_auth schema to hide -- We put things inside the basic_auth schema to hide
-- them from public view. Certain public procs/views will -- them from public view. Certain public procs/views will
@@ -150,7 +148,7 @@ begin
where token_type = 'reset' where token_type = 'reset'
and tokens.email = request_password_reset.email; and tokens.email = request_password_reset.email;
select uuid_generate_v4() into tok; select gen_random_uuid() into tok;
insert into basic_auth.tokens (token, token_type, email) insert into basic_auth.tokens (token, token_type, email)
values (tok, 'reset', request_password_reset.email); values (tok, 'reset', request_password_reset.email);
perform pg_notify('reset', perform pg_notify('reset',