Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/black_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
python -m pip install --upgrade pip
pip install black==19.3b pytest
pip install click==8.0.2
pip install -r app/requirements/mysql.txt
pip install -r app/requirements/postgres.txt
Copy link

@Bachibouzouk Bachibouzouk Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had done this with mysql because for testing purposes I could not find a way to generate automatically the postgres DB, whereas it was easy with mysql

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but with #183 this fails now, because dependencies are not met. Do you need help to fix this? Shall I look into this or do you want to fix it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, I think because of #194 sqlite is used anyways.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to fix this in #197

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bachibouzouk overtakes #197 now

- name: Analysing the code with pylint
run: |
black --check .
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SQL_USER=<your user name>
SQL_PASSWORD=<your password>
SQL_HOST=localhost
SQL_PORT=5432
DEBUG=(True|False)
```
8. Add an environment variable `MVS_HOST_API` and set the url of the simulation server you wish to use for your models
9. Execute the `local_setup.sh` file (`. local_setup.sh` on linux/mac `bash local_setup.sh` on windows) you might have to make it executable first. Answer yes to the question
Expand Down
13 changes: 6 additions & 7 deletions app/epa/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"""
import ast
import os
from django.contrib.messages import constants as messages

from django.contrib.messages import constants as messages

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = ast.literal_eval(os.getenv("DEBUG", "True"))
DEBUG = ast.literal_eval(os.getenv("DEBUG", "False"))

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand All @@ -40,7 +40,6 @@
"EPA_SECRET_KEY", "v@p9^=@lc3#1u_xtx*^xhrv0l3li1(+8ik^k@g-_bzmexb0$7n"
)


ALLOWED_HOSTS = ["*"]

# Application definition
Expand All @@ -64,7 +63,6 @@
if DEBUG is True:
INSTALLED_APPS.append("sass_processor")


MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down Expand Up @@ -125,7 +123,6 @@

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -155,7 +152,6 @@

USE_TZ = False


# Other configs

AUTH_USER_MODEL = "users.CustomUser"
Expand All @@ -166,7 +162,10 @@

CRISPY_TEMPLATE_PACK = "bootstrap4"

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
if DEBUG is True:
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
else:
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
MAILER_EMAIL_BACKEND = EMAIL_BACKEND

DEFAULT_FROM_EMAIL = "noreply@elandh2020.eu"
Expand Down
49 changes: 24 additions & 25 deletions app/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,31 @@

{% block index %}

<main class="signup">
<div class="signup-frame">
<div class="signup-frame__img">
<img src="{% static 'assets/illustrations/open_plan_hero_hexagon.svg' %}" alt="open_plan cells">
</div>
<div class="signup-frame__heading">
{% translate "Welcome to the open_plan tool" %}
</div>
<div class="signup-frame__subheading">
Do you not have an account yet? <a href="{% url 'signup' %}">{% translate "Sign up" %}</a>
</div>
<form method="post" class="signup-frame__form">
{% csrf_token %}
{{ form|crispy }}
<!--<div class="mb-3">
<label for="id_username" class="form-label">{% translate "Email address" %}</label>
<input type="text" class="form-control form-control-lg" id="id_username" placeholder="name@example.com" required name="username">
<main class="signup">
<div class="signup-frame">
<div class="signup-frame__img">
<img src="{% static 'assets/illustrations/open_plan_hero_hexagon.svg' %}"
alt="open_plan cells">
</div>
<div class="signup-frame__heading">
{% translate "Welcome to the open_plan tool" %}
</div>
<div class="mb-3">
<label for="id_password" class="form-label">{% translate "Password" %}</label>
<input type="password" class="form-control form-control-lg" id="id_password" placeholder="Password with at least 8 characters" required name="password">
</div>-->
<button class="btn btn--large" type="submit" id="loginbutton">{% translate "Login" %}</button>
</form>
</div>
</main>
<div class="signup-frame__subheading">
Do you not have an account yet? <a
href="{% url 'signup' %}">{% translate "Sign up" %}</a>
</div>
<div class="signup-frame__subheading">
{% trans "Forgot your password?" %} <a
href="{% url 'password_reset' %}">{% trans "Reset Password" %}</a>
</div>
<form method="post" class="signup-frame__form">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn--large" type="submit"
id="loginbutton">{% translate "Login" %}</button>
</form>
</div>
</main>


{% endblock index %}
13 changes: 13 additions & 0 deletions app/templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}

<div class="container p-5">
<h2 class="font-weight-bold mt-3">{% trans "Password reset complete" %}</h2>
<hr>
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<a href="{% url 'login' %}" class="btn btn-primary">{% trans "Log in" %}</a>
</div>

{% endblock %}
19 changes: 19 additions & 0 deletions app/templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}

{% load crispy_forms_tags %}

<div class="container p-5">
<h2 class="font-weight-bold mt-3">{% trans "Password Reset Confirm" %}</h2>
<hr>
<p>{% trans "Please enter your new password." %}</p>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Reset password" %}</button>
</form>
</div>

{% endblock %}
14 changes: 14 additions & 0 deletions app/templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}

<div class="container p-5">
<h2 class="font-weight-bold mt-3">{% trans "Password reset sent" %}</h2>
<hr>
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}
</p>
</div>

{% endblock %}
19 changes: 19 additions & 0 deletions app/templates/registration/password_reset_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'base.html' %}
{% load i18n %}

{% block content %}

{% load crispy_forms_tags %}

<div class="container p-5">
<h2 class="font-weight-bold mt-3">{% trans "Reset Password" %}</h2>
<hr>
<p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Send email" %}</button>
</form>
</div>

{% endblock %}
8 changes: 0 additions & 8 deletions app/templates/registration/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@
<form method="post" class="signup-frame__form">
{% csrf_token %}
{{ form|crispy }}
<!--<div class="mb-3">
<label for="id_email" class="form-label">{% translate "Email address" %}</label>
<input type="text" class="form-control form-control-lg" id="id_email" placeholder="name@example.com" required>
</div>
<div class="mb-3">
<label for="id_password1" class="form-label">{% translate "Password" %}</label>
<input type="password" class="form-control form-control-lg" id="id_password1" placeholder="Password with at least 8 characters" required>
</div>-->
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Expand Down
87 changes: 42 additions & 45 deletions app/templates/registration/user_info.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,52 @@
{% extends 'base.html' %}
{% load i18n %}

{% load crispy_forms_tags %}

{% block content %}

<main>
<section class="header">
<div>
<div class="header__left"></div>
<h1 class="header__title">Account</h1>
<div class="header__back"></div>
</div>
</section>
<section class="standard-layout">
<div>
<div class="account">
<div>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<br>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<button class="btn btn-primary btn-lg" type="submit">Save Changes
</button>
<main>
<section class="header">
<div>
<div class="header__left"></div>
<h1 class="header__title">Account</h1>
<div class="header__back"></div>
</div>
</section>
<section class="standard-layout">
<div>
<div class="account">
<div>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<br>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<button class="btn btn-primary btn-lg"
type="submit">Save Changes
</button>
</div>
<div class="col-sm-4"></div>
</div>
<div class="col-sm-4"></div>
</div>
<br>
</form>
<!--<form>
<div class="mb-3">
<label for="nameInput" class="form-label">Name</label>
<input type="email" class="form-control" id="nameInput" value="Christian Müller">
</div>
<div class="mb-3">
<label for="emailInput" class="form-label">Email address</label>
<input type="email" class="form-control" id="emailInput" value="christian.mueller@gmail.de">
</div>
<div class="mb-3">
<label for="pwInput" class="form-label">Password</label>
<input type="password" class="form-control" id="pwInput" value="*************">
</div>
<div class="account__save">
<button type="submit" class="btn">Save changes</button>
</div>
</form>-->
<br>
</form>
</div>
</div>
</div>
</section>
<section class="standard-layout">
<div>
<div class="account">
<div>
<a href="{% url 'password_reset' %}">
<button class="btn btn-primary btn-lg"
type="submit">{% trans "Reset Password" %}</button>
</a>
</div>
</div>
</div>
</div>
</section>
</main>
</section>
</main>
{% endblock %}
2 changes: 0 additions & 2 deletions app/users/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field

from .models import CustomUser

Expand Down
1 change: 0 additions & 1 deletion app/users/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib.auth.models import AbstractUser
from django.db import models


class CustomUser(AbstractUser):
Expand Down
9 changes: 0 additions & 9 deletions app/users/tokens.py

This file was deleted.

3 changes: 2 additions & 1 deletion app/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from django.urls import path

from .views import *
from .views import signup, change_password, user_info, activate, password_reset_request

urlpatterns = [
path("signup/", signup, name="signup"),
path("change_password/", change_password, name="change_password"),
path("user_info/", user_info, name="user_info"),
path("activate/<uidb64>/<token>/", activate, name="activate"),
path("password_reset", password_reset_request, name="password_reset"),
]
Loading