diff --git a/.gitignore b/.gitignore index 5c62ca8..6445f60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ data/* test/data/* +.env diff --git a/schema.sql b/schema.sql index b4347f4..679fe5c 100644 --- a/schema.sql +++ b/schema.sql @@ -5,7 +5,7 @@ create table users ( token_expires timestamp, pw_token text, pw_token_expires timestamp, - verified boolean not null default false, + verified boolean not null default 0, created timestamp not null default current_timestamp, updated timestamp ); diff --git a/server.pl b/server.pl index 452f3c5..5a9a3b4 100644 --- a/server.pl +++ b/server.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl +use local::lib; use utf8; use strict; use warnings; @@ -296,7 +297,7 @@ EOF "Your verification token is: $token\n" . "Run this (or equivalent) in a terminal:\n\n" . " curl -H 'Content-Type: application/json' \\\n" . - " -XPUT -d '{\"token\",\"$token\"}' \\\n" . + " -XPUT -d '{\"token\":\"$token\"}' \\\n" . " https://$hostname/users/$email"); print_json_response($cgi, 200, {email => $email}); } @@ -384,7 +385,7 @@ EOF "Run this (or equivalent) in a terminal after adding your desired\n" . "password to the appropriate field in the JSON payload:\n\n" . " curl -H 'Content-Type: application/json' \\\n" . - " -XPUT -d '{\"password\":\"\",\"token\",\"$token\"}' \\\n" . + " -XPUT -d '{\"password\":\"\",\"token\":\"$token\"}' \\\n" . " https://$hostname/users/$email/pwchange"); print_json_response($cgi, 200, {success => 1}); } diff --git a/static/index.html b/static/index.html index 2223e30..01c47c2 100644 --- a/static/index.html +++ b/static/index.html @@ -25,8 +25,8 @@

Dotplan Online

Register the email address test@example.com with password my-password-123 (an email with further instructions will be sent):

    curl -H 'Content-Type: application/json' \
-      -XPUT -d '{"password":"my-password-123"}' \
-      https://dotplan.online/test@example.com
+ -XPOST -d '{"password":"my-password-123"}' \ + https://dotplan.online/users/test@example.com

Retrieve an authentication token for the account created above:

    curl -H 'Accept: application/json' \
       -u 'test@example.com:my-password-123' \