-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from SocialGouv/lionelb/feat-account-creation
feat(user): create user account
- Loading branch information
Showing
62 changed files
with
1,649 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,7 @@ JWT_TOKEN_EXPIRES=15 | |
REFRESH_TOKEN_EXPIRES=43200 | ||
|
||
# Activation token lifetime (7 days in minutes) | ||
ACTIVATION_TOKEN_EXPIRES=10080 | ||
NEXT_PUBLIC_ACTIVATION_TOKEN_EXPIRES=10080 | ||
|
||
ACCOUNT_MAIL_SENDER=[email protected] | ||
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.next | ||
*.DS_Store | ||
node_modules | ||
node_modules | ||
.env.production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,14 @@ variables: | |
ENABLE_AZURE_POSTGRES: 1 | ||
VALUES_FILE: ./.k8s/app.values.yml | ||
|
||
Build: | ||
extends: .autodevops_build | ||
variables: | ||
# these variables are needed at build time because embedded in the front | ||
NEXT_PUBLIC_SENTRY_DSN: https://[email protected]/yyy | ||
NEXT_PUBLIC_MATOMO_URL: https://matomo.io | ||
NEXT_PUBLIC_MATOMO_SITE_ID: 4242 | ||
|
||
Create namespace: | ||
extends: | ||
- .autodevops_create_namespace | ||
|
@@ -53,7 +61,7 @@ Deploy app Hasura (dev): | |
- .autodevops_deploy_app_dev | ||
- .deploy_hasura | ||
variables: | ||
PG_HOST: cdtnadmin.postgres.database.azure.com | ||
PG_HOST: cdtnadmindevserver.postgres.database.azure.com | ||
HELM_RENDER_ARGS: >- | ||
--set deployment.env[7].name=HASURA_GRAPHQL_DATABASE_URL | ||
--set deployment.env[7].value=postgresql://user_${CI_COMMIT_SHORT_SHA}%40${PG_HOST}:pass_${CI_COMMIT_SHORT_SHA}@${PG_HOST}:5432/db_${CI_COMMIT_SHORT_SHA}?sslmode=require | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,13 +31,13 @@ deployment: | |
env: | ||
- name: PRODUCTION | ||
value: "${PRODUCTION}" | ||
- name: NEXT_PUBLIC_FRONTEND_URL | ||
- name: FRONTEND_URL | ||
value: https://${HOST} | ||
- name: GRAPHQL_ENDPOINT | ||
value: "http://hasura-cdtn-admin/v1/graphql" | ||
- name: ACCOUNT_MAIL_SENDER | ||
value: "[email protected]" | ||
- name: NEXT_PUBLIC_FRONTEND_URL | ||
- name: PORT | ||
value: "${PORT}" | ||
envFrom: | ||
- secretRef: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ create schema auth; | |
create table auth.users( | ||
id uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, | ||
email email UNIQUE NOT NULL, | ||
password text NOT NULL CONSTRAINT password_min_length CHECK ( char_length(password) >= 8 ), | ||
password text DEFAULT 'mot de passe'::text NOT NULL CONSTRAINT password_min_length CHECK ( char_length(password) >= 8 ), | ||
name text NOT NULL, | ||
active boolean DEFAULT false NOT NULL, | ||
default_role text DEFAULT 'user'::text NOT NULL REFERENCES public.roles (role) on update cascade on delete restrict, | ||
|
@@ -80,7 +80,7 @@ COMMENT ON TABLE auth.user_roles | |
IS 'User_role table allow many-to-many relationship between users and roles'; | ||
|
||
WITH admin_row AS ( | ||
INSERT INTO auth.users(email, password, name, default_role, active) VALUES ('[email protected].gouv.fr', '$argon2i$v=19$m=4096,t=3,p=1$n9eoWSv+5sCgc7SjB5hLig$iBQ7NzrHHLkJSku/dCetNs+n/JI1CMdkWaoZsUekLU8', 'big boss', 'admin', true) | ||
INSERT INTO auth.users(email, password, name, default_role, active) VALUES ('codedutravailnumerique@travail.gouv.fr', '$argon2i$v=19$m=4096,t=3,p=1$n9eoWSv+5sCgc7SjB5hLig$iBQ7NzrHHLkJSku/dCetNs+n/JI1CMdkWaoZsUekLU8', 'big boss', 'admin', true) | ||
RETURNING id, default_role | ||
) | ||
INSERT INTO auth.user_roles(role, user_id) SELECT default_role, id FROM admin_row; | ||
|
@@ -110,9 +110,3 @@ CREATE TRIGGER "set_auth_refresh_tokens_updated_at" | |
|
||
COMMENT ON TRIGGER "set_auth_refresh_tokens_updated_at" ON auth.refresh_tokens | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; | ||
|
||
|
||
-- | ||
-- Public user view | ||
-- | ||
CREATE VIEW users AS SELECT id, name, email, active, default_role, secret_token, secret_token_expires_at, created_at, updated_at from auth.users; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.