diff --git a/website/nutriform/templates/nutriform/base.html b/website/nutriform/templates/nutriform/base.html new file mode 100644 index 0000000000000000000000000000000000000000..80eede345eb6c211cfb9b4cb6325f8cc9cc7565b --- /dev/null +++ b/website/nutriform/templates/nutriform/base.html @@ -0,0 +1,45 @@ +{% load static %} +<!DOCTYPE HTML> +<!-- + Spatial by TEMPLATED + templated.co @templatedco + Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) +--> +<html> + <head> + <title>NutriForm</title> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <link rel="stylesheet" href="{% static 'nutriform/assets/css/main.css' %}" /> + </head> + <body class="landing"> + + + + {% block content %} + {% endblock %} + + <!-- Footer --> + <footer id="footer"> + <div class="container"> + <ul class="icons"> + <li><a href="#" class="icon fa-facebook"></a></li> + <li><a href="#" class="icon fa-twitter"></a></li> + <li><a href="#" class="icon fa-instagram"></a></li> + </ul> + <ul class="copyright"> + <li>© NutriForm</li> + <li>Design: <a href="http://templated.co">TEMPLATED</a></li> + <li>Images: <a href="http://unsplash.com">Unsplash</a></li> + </ul> + </div> + </footer> + + <!-- Scripts --> + <script src="{% static 'nutriform/assets/js/jquery.min.js' %}"></script> + <script src="{% static 'nutriform/assets/js/skel.min.js' %}"></script> + <script src="{% static 'nutriform/assets/js/util.js' %}"></script> + <script src="{% static 'nutriform/assets/js/main.js' %}"></script> + + </body> +</html> \ No newline at end of file diff --git a/website/nutriform/templates/nutriform/index.html b/website/nutriform/templates/nutriform/index.html index 4e50c0d67540b331e31f7d1a8b93e67d120f5fb7..90a1a91c926a190f2282eda13c3a29776387563f 100644 --- a/website/nutriform/templates/nutriform/index.html +++ b/website/nutriform/templates/nutriform/index.html @@ -33,7 +33,7 @@ <h2>NutriForm</h2> <p>La solution pour vos conseils bien-être<br/> Par le super groupe de PIMA</p> <ul class="actions"> - <li><a href="#" class="button special big">Je m'inscris</a></li> + <li><a href="{% url 'login' %}" class="button special big">Je m'inscris</a></li> </ul> </section> @@ -143,6 +143,7 @@ <p>N'hésitez pas à nous contacter !</p> </header> <form method="post" action="#"> + {% csrf_token %} <div class="row uniform 50%" style="color: whitesmoke;"> <div class="6u 12u$(xsmall)"> <input type="text" name="name" id="name" value="" placeholder="Nom" /> diff --git a/website/nutriform/templates/registration/login.html b/website/nutriform/templates/registration/login.html index 048cc7b55dea4a47b345b3e709de5fd6373eb6a3..bb549e84c2168f6627e21247499ca1cdb79ae7dd 100644 --- a/website/nutriform/templates/registration/login.html +++ b/website/nutriform/templates/registration/login.html @@ -1,5 +1,33 @@ -{% extends "../plateforme/base.html" %} +{% extends "../nutriform/base.html" %} {% block content %} -{% endblock %} +<div class="container"> +{% if form.errors %} +<p>Your username and password didn't match. Please try again.</p> +{% endif %} + +{% if next %} + {% if user.is_authenticated %} + <p>Your account doesn't have access to this page. To proceed, + please login with an account that has access.</p> + {% else %} + <p>Please login to see this page.</p> + {% endif %} +{% endif %} + +<form method="post" action="{% url 'login' %}"> +{% csrf_token %} + + {{ form.username.label_tag }} + {{ form.username }} + + {{ form.password.label_tag }} + {{ form.password }} + +<input type="submit" value="login" style="margin-top: 5px;"> +<input type="hidden" name="next" value="{{ next }}"> +</form> + +</div class="container"> +{% endblock %} \ No newline at end of file diff --git a/website/nutriform/urls.py b/website/nutriform/urls.py index 9654d32f26f2bb92282cf880963250c9168388d5..8e30042de702e3026fe3c4772a45430116f0657a 100644 --- a/website/nutriform/urls.py +++ b/website/nutriform/urls.py @@ -1,7 +1,8 @@ -from django.urls import path +from django.urls import path, include from . import views urlpatterns = [ path('', views.index, name='index'), + path('accounts/', include('django.contrib.auth.urls')) ] diff --git a/website/nutriform/views.py b/website/nutriform/views.py index b38009b9d67ae2e74c32b1c65e534b9fe4a6aca5..747ea6fb863ca838f4763bb4678a137b252a7f47 100644 --- a/website/nutriform/views.py +++ b/website/nutriform/views.py @@ -1,7 +1,17 @@ from django.shortcuts import render from django.http import HttpResponse +from django.core.mail import send_mail def index(request): + if request.method == 'POST' : + if request.POST['name'] and request.POST['email'] and request.POST['message'] : + send_mail( + 'Contact: '+request.POST['name'], + 'from : '+request.POST['email']+'\n\n'+request.POST['message'], + request.POST['email'], + ['charles.anteunis@gmail.com',] + ) + return render(request, 'nutriform/index.html') # Create your views here. diff --git a/website/website/settings.py b/website/website/settings.py index a4afcf1011b58d5545a8cbbcd56cdd1737f6dd9e..ff4902d36f44c129ce42d0eff94fe57ac045e787 100644 --- a/website/website/settings.py +++ b/website/website/settings.py @@ -22,6 +22,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '2c^k19waap+)_bcypl^jyi83yvlt%da$)w!6hn)@8zs$3au5wh' +# SECURITY WARNING: +mdp = "dntzzrgabemlgbra" + # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -114,6 +117,16 @@ USE_L10N = True USE_TZ = True +#paramètres mail +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_PORT = 587 +EMAIL_HOST_USER = 'nutriformpima@gmail.com' +EMAIL_HOST_PASSWORD = mdp +EMAIL_USE_TLS = True + +ADMINS = [('Charles', 'charles.anteunis@gmail.com'),] + + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/