Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

feat: switch over to passport.js #314

Merged
merged 65 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3969cb0
feat: switch over to passport.js
coderbyheart Aug 24, 2021
d1f8aec
feat: update auth context and implement cookie renewal
coderbyheart Aug 25, 2021
26644e6
fix: use uuid to generate usernames
coderbyheart Aug 25, 2021
93327f9
fix: update docs
coderbyheart Aug 25, 2021
3fd8975
feat: add login and registration to frontend
coderbyheart Aug 26, 2021
6e81503
fix: update depdendencies
coderbyheart Aug 29, 2021
b4e8a1f
fix: switch to Node.js 16
coderbyheart Aug 29, 2021
8134299
fix: use email instead of username
coderbyheart Aug 30, 2021
eae1110
feat: prefer TypeScript migrations
coderbyheart Aug 30, 2021
d3e3358
fix: update dependencies
coderbyheart Aug 31, 2021
0a9e9e1
feat: implement password change (logged in)
coderbyheart Aug 31, 2021
c6eb6e1
fix: remove penalty
coderbyheart Aug 31, 2021
b62778b
feat: implement password reset with token
coderbyheart Aug 31, 2021
ef8ba2b
feat: make email lowercase
coderbyheart Aug 31, 2021
3395e60
refactor: rewrite migrations in TypeScript
coderbyheart Sep 1, 2021
550d54d
fix: email is lowercased
coderbyheart Sep 1, 2021
952a9cb
fix: ensure email is case-insensitive
coderbyheart Sep 1, 2021
ab5d602
feat: confirm registration using email and code
coderbyheart Sep 1, 2021
f90d167
feat: add bus for emailing
coderbyheart Sep 1, 2021
adc2832
feat: implement sending emails via SMTP
coderbyheart Sep 2, 2021
8fe993a
feat(frontend): hook up API
coderbyheart Sep 2, 2021
c26dd5e
fix: use context in hook for shared state
coderbyheart Sep 5, 2021
618003d
fix: show which server is used for emails sending
coderbyheart Sep 5, 2021
9699143
fix: re-add ApolloProvider
coderbyheart Sep 5, 2021
bed510a
fix: use token instead of code
coderbyheart Sep 6, 2021
4ef293c
fix(db): add migration for ShipmentReceivingHub and ShipmentSendingHu…
coderbyheart Sep 6, 2021
7eb9755
test(email): add test for appMailer
coderbyheart Sep 6, 2021
dfda97f
feat: implement FriendlyCaptcha
coderbyheart Sep 6, 2021
1cbaf25
test: add test for friendly captcha middleware
coderbyheart Sep 7, 2021
bd33812
docs(backend): fix info in package.json
coderbyheart Sep 7, 2021
6d67044
fix: convert CAPTCHA to use context
coderbyheart Sep 7, 2021
436628b
fix: remove friendlyCaptch for now
coderbyheart Sep 8, 2021
1603b93
build: add backend-only server
coderbyheart Sep 8, 2021
27bef59
build: add shortcut to build server and frontend
coderbyheart Sep 8, 2021
61c0a10
build(clevercloud): add DB configuration
coderbyheart Sep 8, 2021
4baf5f4
fix(sequelize): allow multiple configs with URI
coderbyheart Sep 8, 2021
1294d3a
fix(frontend): remove friendly captcha for now
coderbyheart Sep 8, 2021
e676c25
docs(frontend): set node.js version to 16
coderbyheart Sep 8, 2021
31511e8
build: downgrade node version so it works on clever cloud
coderbyheart Sep 8, 2021
dc3af6d
build: add script to deploy to Clever Cloud cellar
coderbyheart Sep 9, 2021
f40ffd1
build(clevercloud): install rclone
coderbyheart Sep 9, 2021
6e2ff92
docs(frontend): node.js 16 is fine
coderbyheart Sep 9, 2021
22e6709
build: use local rclone
coderbyheart Sep 9, 2021
7bc2460
build: use rclone from local folder
coderbyheart Sep 9, 2021
fc53c96
build: use only bucket name
coderbyheart Sep 9, 2021
386b5d9
build: echo progress
coderbyheart Sep 9, 2021
296730e
fix(frontend): only hardcode env vars for development
coderbyheart Sep 9, 2021
13caeee
fix(frontend): use only one server URL env var
coderbyheart Sep 9, 2021
e3b7f93
fix: ensure Access-Control-Allow-Origin has no trailing slash
coderbyheart Sep 9, 2021
1c79ec3
fix(passwords): do not enforce special characters
coderbyheart Sep 9, 2021
e3d6a09
fix: sent cookies with sameSite=none
coderbyheart Sep 13, 2021
29bdaf5
feat: remove UserProfileContext, add more auth pages
coderbyheart Sep 13, 2021
e2e5989
fix: include credentials with log-in, too
coderbyheart Sep 13, 2021
9bf8ebd
fix: remove unused LoginButton
coderbyheart Sep 13, 2021
a8f954c
fix(logout): reload to /
coderbyheart Sep 13, 2021
cf7d2df
feat: include version string
coderbyheart Sep 13, 2021
5157cc9
build(frontend): fail on errors
coderbyheart Sep 13, 2021
31713a0
ci(cd): change to correct folder
coderbyheart Sep 13, 2021
83755fe
fix: print running version
coderbyheart Sep 13, 2021
21f42c3
fix: version middleware must come before routes
coderbyheart Sep 13, 2021
8680b84
fix: logout url has colon
coderbyheart Sep 13, 2021
6e145ea
fix: remove log statement
coderbyheart Sep 13, 2021
1405c2b
fix(env): remove dotenve so order of imports is not important
coderbyheart Sep 15, 2021
d113d3a
docs(devcontainer): update dev container to run tests
coderbyheart Sep 15, 2021
abbc315
test(authentication): use correct cookie attributes
coderbyheart Sep 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .clevercloud/publish-frontend-to-cellar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -x
set -e

cd frontend
export REACT_APP_VERSION=$COMMIT_ID
yarn build
cd ..

curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip

echo "Uploading site to bucket $CELLAR_BUCKET ..."

export RCLONE_CONFIG_MYS3_ACCESS_KEY_ID=$CELLAR_ADDON_KEY_ID
export RCLONE_CONFIG_MYS3_SECRET_ACCESS_KEY=$CELLAR_ADDON_KEY_SECRET
export RCLONE_CONFIG_MYS3_ENDPOINT=$CELLAR_ADDON_HOST
export RCLONE_CONFIG_MYS3_TYPE="s3"

./rclone-*-linux-amd64/rclone sync ./frontend/build mys3:$CELLAR_BUCKET --progress --s3-acl=public-read

echo "Done. Site should be available on $ORIGIN now."
8 changes: 7 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo

# Add role for user node
RUN /etc/init.d/postgresql start \
&& sudo -u postgres createuser -s node
&& sudo -u postgres createuser -s node

# Add role and db for user distributeaid_test
RUN /etc/init.d/postgresql start \
&& sudo -u postgres createuser -s distributeaid_test \
&& sudo -u postgres psql -c "ALTER USER distributeaid_test PASSWORD 'distributeaid_test';" \
&& sudo -u postgres createdb distributeaid_test
5 changes: 1 addition & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
"build": {
"dockerfile": "Dockerfile"
},
"settings": {
"terminal.integrated.shell.linux": "/bin/zsh"
},
"extensions": [
"esbenp.prettier-vscode",
"jpoissonnier.vscode-styled-components",
"graphql.vscode-graphql"
],
"forwardPorts": [3000],
"postCreateCommand": "script/dev_setup && yarn dev",
"postCreateCommand": "sudo /etc/init.d/postgresql start && yarn run build && npx sequelize-cli --env=test db:migrate",
"remoteUser": "node"
}
6 changes: 0 additions & 6 deletions .env.example

This file was deleted.

12 changes: 12 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See https://direnv.net/ about how to use this file.

# The URL of the web app, used to restrict CORS requests
# CLIENT_URL="http://localhost:8080"

# Fill in to enable email sending
# [email protected]
# SMTP_SERVER=example.com
# [email protected]
# SMTP_PASSWORD=secret
# SMTP_SECURE=false
# SMTP_PORT=587
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.15.5
node-version: '16.x'

# Cache node_modules between builds based on the yarn.lock file's hash.
- uses: actions/cache@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/frontend-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install modules
run: yarn --frozen-lockfile
- name: Run codegen
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.envrc

npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion .node-version

This file was deleted.

2 changes: 1 addition & 1 deletion .sequelizerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var path = require('path')

module.exports = {
'config': path.resolve('db', 'config.json'),
'migrations-path': path.resolve('db', 'migrations'),
'migrations-path': path.resolve('dist', 'db', 'migrations'),
'seeders-path': path.resolve('db', 'seeders'),
'models-path': path.resolve('src', 'models')
}
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 14.15.5
nodejs 16
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If the pull request does not require additional changes, the reviewer should mer

## Dev setup

Install node.js v14:
Install node.js v16:

- Install with [nodenv](https://github.com/nodenv/nodenv)
- or [nvm](https://github.com/nvm-sh/nvm)
Expand All @@ -73,7 +73,6 @@ See [the README in the `frontend` directory](/frontend/README.md) for instructio

- [Database Migrations](./docs/migrations.md)
- [Graphql Codegen](./docs/codegen.md)
- [Auth0 configuration](./docs/auth0.md)

### Type definitions

Expand Down
14 changes: 12 additions & 2 deletions db/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"dialect": "postgres"
},
"test": {
"username": "distributeaid",
"password": null,
"username": "distributeaid_test",
"password": "distributeaid_test",
"database": "distributeaid_test",
"host": "127.0.0.1",
"dialect": "postgres"
Expand All @@ -29,5 +29,15 @@
"rejectUnauthorized": false
}
}
},
"clevercloud": {
"use_env_variable": "POSTGRESQL_ADDON_URI",
"dialect": "postgres",
"dialectOptions": {
"ssl": {
"require": true,
"rejectUnauthorized": false
}
}
}
}
Loading