feat(reset_password): add invitation and reset password activation basic flow

This commit is contained in:
Matthieu Bessat 2024-12-02 18:39:00 +01:00
parent b956bdbf05
commit 8d20cab18f
14 changed files with 328 additions and 20 deletions

View file

@ -1,3 +1,5 @@
#!/usr/bin/bash
password_hash="$(echo -n "root" | argon2 salt_06cGGWYDJCZ -e)"
echo $password_hash
SQL=$(cat <<EOF

View file

@ -0,0 +1,9 @@
applications = []
roles = []
[instance]
base_uri = "http://localhost:8086"
name = "Example org"
logo_uri = "https://example.org/logo.png"

View file

@ -0,0 +1,9 @@
#!/usr/bin/bash
SQL=$(cat <<EOF
INSERT INTO users
(id, handle, email, roles, status, reset_password_token, created_at)
VALUES
('$(uuid)', 'invited_user', 'invited-user@example.org', '[]', 'Invited', 'Z433-Y001-V987-P500', '2024-11-30T00:00:00Z');
EOF)
echo $SQL | sqlite3 $DB_PATH

View file

@ -0,0 +1,28 @@
GET {{ base_url }}/api
HTTP 200
[Asserts]
jsonpath "$.software" == "Minauthator"
GET {{ base_url }}/invitation
[QueryStringParams]
token: Z433-Y001-V987-P500
HTTP 200
[Asserts]
xpath "string(///h1)" contains "Invitation"
POST {{ base_url }}/reset-password
[FormParams]
token: Z433-Y001-V987-P500
password: newpassword10!
password_confirmation: newpassword10!
HTTP 303
[Asserts]
header "Location" == "/login"
POST {{ base_url }}/login
[FormParams]
login: invited_user
password: newpassword10!
HTTP 303
[Asserts]
cookie "minauthator_jwt" exists

View file

@ -1,5 +1,12 @@
INSERT INTO users
(id, handle, email, roles, status, password_hash, created_at)
VALUES
('30c134a7-d541-4ec7-9310-9c8e298077db', 'test', 'test@example.org', '[]', 'Active', '$argon2i$v=19$m=4096,t=3,p=1$V2laYjAwTlFHOUpiekRlVzRQUU0$33h8XwAWM3pKQM7Ksler0l7rMJfseTuWPJKrdX/cGyc', '2024-11-30T00:00:00Z');
-- INSERT INTO users
-- (id, handle, email, roles, status, password_hash, created_at)
-- VALUES
-- ('30c134a7-d541-4ec7-9310-9c8e298077db', 'test', 'test@example.org', '[]', 'Active', '$argon2i$v=19$m=4096,t=3,p=1$V2laYjAwTlFHOUpiekRlVzRQUU0$33h8XwAWM3pKQM7Ksler0l7rMJfseTuWPJKrdX/cGyc', '2024-11-30T00:00:00Z');
--
INSERT INTO users
(id, handle, email, roles, status, reset_password_token, created_at)
VALUES
('00000001-0042-0001-0001-00000000432', 'invited_user1', 'invited-user1@example.org', '[]', 'Invited', 'A909-Z539-L128-O400', '2024-11-30T00:00:00Z');