Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #354 from SELab-2/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
sevrijss authored Apr 20, 2023
2 parents 9bec1c6 + 2ef664e commit 08a3bc0
Show file tree
Hide file tree
Showing 268 changed files with 24,586 additions and 5,700 deletions.
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/frontend"
schedule:
interval: "daily"
reviewers:
- "n00bS-oWn-m3"
open-pull-requests-limit: 10
target-branch: "develop"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]

- package-ecosystem: "pip"
directory: "/backend"
schedule:
interval: "daily"
reviewers:
- "n00bS-oWn-m3"
open-pull-requests-limit: 10
target-branch: "develop"

37 changes: 37 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Format Code Base

on:
pull_request:
branches:
- main
- develop

jobs:
format:
name: Format Code Base
runs-on: ubuntu-latest
# don't format the Dependabot PR's, for security reasons (can't access secrets.GITHUB_TOKEN)
if: ${{ github.actor != 'dependabot[bot]' }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

# using `black` for Python
- name: Format Python code
uses: rickstaa/[email protected]
id: action_black
with:
black_args: ". --line-length 120"

# using `prettier` for JavaScript
- name: Format JavaScript code
uses: creyD/[email protected]
with:
prettier_options: --print-width 120 --tab-width 4 --write **/*.{js,tsx}
commit_message: "Auto formatted code"
only_changed: true
github_token: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test Code Base

on:
pull_request:
branches:
- main
- develop

jobs:
test:
name: Test Code Base
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build Docker
run: docker-compose build

- name: Run Tests
run: |
docker-compose run -e "DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" -e "SECRET_EMAIL_USER=${{ secrets.SECRET_EMAIL_USER }}" -e "SECRET_EMAIL_USER_PSWD=${{ secrets.SECRET_EMAIL_USER_PSWD }}" --name backend_test backend python manage.py test picture_of_remark/tests.py users/tests.py remark_at_building/tests.py lobby/tests.py email_template/tests.py building/tests.py role/tests.py building_comment/tests.py building_on_tour/tests.py garbage_collection/tests.py manual/tests.py region/tests.py tour/tests.py --with-coverage --cover-package=lobby,email_template,building,building_on_tour,garbage_collection,manual,region,tour,building_comment,role,remark_at_building,picture_of_remark,users --with-xunit --xunit-file=/app/coverage.xml
docker cp backend_test:/app/coverage.xml coverage.xml
docker-compose down
- name: Publish Test Results
uses: EnricoMi/[email protected]
if: always()
with:
files: |
coverage.xml
- name: Clean up
if: always()
run: |
docker compose down --rmi all
docker compose rm -sfv
rm -rf coverage.xml
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# Dr-Trottoir-4
# Dr-Trottoir-4

## How to get started
This repository contains our solution for [Dr. Trottoir's](https://drtrottoir.be/) web application that will
be used to facilitate their workflow for both the employers and employees. To that end, we have decided to
use the following software stack:
* Database: [PostgreSQL](https://www.postgresql.org/)
* Backend: [Django](https://www.djangoproject.com/)
* Frontend: [Next.js](https://nextjs.org/)

Our full-stack app is also containerized with [Docker](https://www.docker.com/). This means that you will have to
install [Docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/) first.
Another useful tool worth considering is [Docker Desktop](https://www.docker.com/products/docker-desktop/). This will
provide a GUI with lots of extra features that will make the docker experience more pleasant.

To run the docker container you can use the following command:
```bash
docker-compose up
```
Whenever you need to rebuild your containers, use:
```bash
docker-compose build
```

Or if you want to rebuild and then run at the same time, use:
```bash
docker-compose up --build -d
```

To stop the containers, run `docker-compose down` or press `Ctrl+C` if the process is running in the foreground.
Alternatively, you can use the stop button in Docker Desktop.

This covers the basics of how to run our code. For more detailed instructions and information about our implementations,
please check out our [wiki](https://github.com/SELab-2/Dr-Trottoir-4/wiki/)

## Members of Team 4
* [Emma Neirinck](https://github.com/emneirin)
* [Jonathan Casters](https://github.com/jonathancasters)
* [Sebastiaan de Oude](https://github.com/n00bS-oWn-m3)
* [Seppe Van Rijsselberghe](https://github.com/sevrijss)
* [Sheng Tao Tian](https://github.com/GashinRS)
* [Simon Van den Bussche](https://github.com/simvadnbu)
* [Tibo Stroo](https://github.com/TiboStr)
2 changes: 1 addition & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ venv
env
.env
Dockerfile

.coverage
6 changes: 0 additions & 6 deletions backend/authentication/apps.py

This file was deleted.

45 changes: 45 additions & 0 deletions backend/authentication/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from allauth.account.adapter import get_adapter
from allauth.account.forms import default_token_generator
from allauth.account.utils import user_pk_to_url_str
from allauth.utils import build_absolute_uri
from dj_rest_auth.forms import AllAuthPasswordResetForm
from django.contrib.sites.shortcuts import get_current_site
from django.urls import reverse

from config import settings


class CustomAllAuthPasswordResetForm(AllAuthPasswordResetForm):
def save(self, request, **kwargs):
current_site = get_current_site(request)
email = self.cleaned_data["email"]
token_generator = kwargs.get("token_generator", default_token_generator)

for user in self.users:
temp_key = token_generator.make_token(user)

# save it to the password reset model
# password_reset = PasswordReset(user=user, temp_key=temp_key)
# password_reset.save()

# send the password reset email
path = reverse(
"password_reset_confirm",
args=[user_pk_to_url_str(user), temp_key],
)

if settings.REST_AUTH["PASSWORD_RESET_USE_SITES_DOMAIN"]:
url = build_absolute_uri(None, path)
else:
url = build_absolute_uri(request, path)

url = url.replace("%3F", "?")
context = {
"current_site": current_site,
"user": user,
"first_name": user.first_name,
"password_reset_url": url,
"request": request,
}
get_adapter(request).send_mail("account/email/password_reset_key", email, context)
return self.cleaned_data["email"]
Loading

0 comments on commit 08a3bc0

Please sign in to comment.