From fde8470c5e47434df8c854bd3135763062fada12 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 5 Mar 2020 19:28:24 +0530 Subject: fixed file structure and added forgot passowrd link --- .../admin/templates/clearable_file_input.html | 13 ++ .../static/admin/templates/forgot-password.html | 54 ++++++ arduino_blog/static/admin/templates/message.html | 17 ++ arduino_blog/static/admin/templates/profile.html | 91 +++++++++ .../registration/password_change_done.html | 19 ++ .../registration/password_change_form.html | 18 ++ .../registration/password_reset_complete.html | 19 ++ .../registration/password_reset_confirm.html | 64 +++++++ .../registration/password_reset_done.html | 20 ++ .../registration/password_reset_form.html | 30 +++ .../static/admin/templates/update-password.html | 41 ++++ .../static/admin/templates/user-login.html | 74 ++++++++ .../static/admin/templates/user-register.html | 108 +++++++++++ .../static/admin/templates/view-profile.html | 210 +++++++++++++++++++++ arduino_blog/templates/login.html | 47 +++-- arduino_blog/templates/user-register.html | 2 +- arduino_projects_website/settings.py | 13 +- arduino_projects_website/urls.py | 31 +++ 18 files changed, 839 insertions(+), 32 deletions(-) create mode 100644 arduino_blog/static/admin/templates/clearable_file_input.html create mode 100644 arduino_blog/static/admin/templates/forgot-password.html create mode 100644 arduino_blog/static/admin/templates/message.html create mode 100644 arduino_blog/static/admin/templates/profile.html create mode 100644 arduino_blog/static/admin/templates/registration/password_change_done.html create mode 100644 arduino_blog/static/admin/templates/registration/password_change_form.html create mode 100644 arduino_blog/static/admin/templates/registration/password_reset_complete.html create mode 100644 arduino_blog/static/admin/templates/registration/password_reset_confirm.html create mode 100644 arduino_blog/static/admin/templates/registration/password_reset_done.html create mode 100644 arduino_blog/static/admin/templates/registration/password_reset_form.html create mode 100644 arduino_blog/static/admin/templates/update-password.html create mode 100644 arduino_blog/static/admin/templates/user-login.html create mode 100644 arduino_blog/static/admin/templates/user-register.html create mode 100644 arduino_blog/static/admin/templates/view-profile.html diff --git a/arduino_blog/static/admin/templates/clearable_file_input.html b/arduino_blog/static/admin/templates/clearable_file_input.html new file mode 100644 index 0000000..4002c00 --- /dev/null +++ b/arduino_blog/static/admin/templates/clearable_file_input.html @@ -0,0 +1,13 @@ +{% if widget.is_initial %} +
+

{{ widget.initial_text }}: {{ widget.value }} + {% if not widget.required %} +     + +   + {% endif %} +
+{% endif %} + + +{% if widget.is_initial %}

{% endif %} \ No newline at end of file diff --git a/arduino_blog/static/admin/templates/forgot-password.html b/arduino_blog/static/admin/templates/forgot-password.html new file mode 100644 index 0000000..24eb95c --- /dev/null +++ b/arduino_blog/static/admin/templates/forgot-password.html @@ -0,0 +1,54 @@ +{% extends "website/templates/base.html" %} +{% load widget_tweaks %} +{% block content %} +{% load static %} + + +


+
+
+

Forgot Password

+ +
+
+
Already Registered?
+
Login
+
+ +
+ +
+{% endblock %} + +{% block javascript %} + $(".alert").alert(); +{% endblock %} \ No newline at end of file diff --git a/arduino_blog/static/admin/templates/message.html b/arduino_blog/static/admin/templates/message.html new file mode 100644 index 0000000..6493cbe --- /dev/null +++ b/arduino_blog/static/admin/templates/message.html @@ -0,0 +1,17 @@ +{% extends 'website/templates/base.html' %} +{% load widget_tweaks %} +{% load static %} +{% block title %}Successful{% endblock %} +{% block cssblock %} + +{% endblock %} +{% block search %} +{% endblock %} +{% block content %} +

+

Thank you for registering.
+Your account activation link has been sent to the email id provided.

+ +{% endblock %} + + diff --git a/arduino_blog/static/admin/templates/profile.html b/arduino_blog/static/admin/templates/profile.html new file mode 100644 index 0000000..6a96243 --- /dev/null +++ b/arduino_blog/static/admin/templates/profile.html @@ -0,0 +1,91 @@ +{% extends 'website/templates/base.html' %} +{% load widget_tweaks %} +{% load static %} + +{% block title %}User Profile{% endblock %} +{% block cssblock %}{% endblock %} +{% block heading %} + User Profile +{% endblock %} + +{% block content %} + +
+
+ +
+
+ +
+ Field required +

Fields required to access basic features of forum
+ +{% endblock %} + + diff --git a/arduino_blog/static/admin/templates/registration/password_change_done.html b/arduino_blog/static/admin/templates/registration/password_change_done.html new file mode 100644 index 0000000..36ce7b4 --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_change_done.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} + +{% block title %} Password change successful {% endblock %} +{% block pagetitle %} Password reset done{% endblock %} +{% block formtitle %} Open Source Hardware Project {% endblock %} +{% block content %} +{% load static %} + +
+
+
+
+

Your password has been changed successfully.

+

Go to home page.

+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/arduino_blog/static/admin/templates/registration/password_change_form.html b/arduino_blog/static/admin/templates/registration/password_change_form.html new file mode 100644 index 0000000..21f33e8 --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_change_form.html @@ -0,0 +1,18 @@ +{% extends MODERATOR_ACTIVATED|yesno:'website/templates/moderator/base.html,website/templates/base.html' %} + +{% block title %} Change Password {% endblock %} + +{% block pagetitle %} FOSSEE Forums {% endblock %} + +{% block content %} +
+ {% csrf_token %} +
+ + {{ form }} +
+
+
+
+
+{% endblock content %} diff --git a/arduino_blog/static/admin/templates/registration/password_reset_complete.html b/arduino_blog/static/admin/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..0d8e410 --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_reset_complete.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% block title %} Password reset complete {% endblock %} +{% block pagetitle %} Password reset {% endblock %} +{% block formtitle %} Open Source Hardware Project {% endblock %} +{% block content %} +{% load static %} + +
+
+
+
+

Your password has been reset.

+

Log in

+
+
+
+
+ +{% endblock %} diff --git a/arduino_blog/static/admin/templates/registration/password_reset_confirm.html b/arduino_blog/static/admin/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..4787a8b --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_reset_confirm.html @@ -0,0 +1,64 @@ +{% extends "base.html" %} +{% block title %}Reset Password{% endblock %} +{% block pagetitle %} Password reset {% endblock %} +{% block formtitle %} Open Source Hardware Project {% endblock %} +{% block content %} +{% load static %} +
+
+
+
+

Password Reset

+
+ {% if validlink %} +

Please enter your new password twice. + So we can verify you typed it in correctly.

+
+
+ +
+ + + + + + + + + + + + +
{{ form.new_password1.errors }} + {{ form.new_password1 }}
{{ form.new_password2.errors }} + {{ form.new_password2 }}
+
+
+ {% else %} +

Password reset unsuccessful

+

The password reset link was invalid,
+ possibly because it has already been used.
+ Please request a new password reset.

+ {% endif %} +
+
+
+ + +{% endblock %} diff --git a/arduino_blog/static/admin/templates/registration/password_reset_done.html b/arduino_blog/static/admin/templates/registration/password_reset_done.html new file mode 100644 index 0000000..acc337e --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_reset_done.html @@ -0,0 +1,20 @@ + +{% extends "base.html" %} +{% block title %} Password reset successful {% endblock %} +{% block pagetitle %} Open Source Hardware Project {% endblock %} +{% block formtitle %} Email will be send to the registered email address {% endblock %} +{% block content %} +{% load static %} +
+
+
+
+

Password reset

+ +
+
+
+
+{% endblock %} diff --git a/arduino_blog/static/admin/templates/registration/password_reset_form.html b/arduino_blog/static/admin/templates/registration/password_reset_form.html new file mode 100644 index 0000000..c852809 --- /dev/null +++ b/arduino_blog/static/admin/templates/registration/password_reset_form.html @@ -0,0 +1,30 @@ + +{% extends "base.html" %} +{% block title %} Forgot Password {% endblock %} +{% block pagetitle %} Open Source Hardware Project {% endblock %} +{% block formtitle %} Email will be send to the registered email address {% endblock %} +{% block content %} +{% load static %} +
+
+
+
+

Recovery Email

+ +
+
+
+
+{% endblock content %} diff --git a/arduino_blog/static/admin/templates/update-password.html b/arduino_blog/static/admin/templates/update-password.html new file mode 100644 index 0000000..33eb1d6 --- /dev/null +++ b/arduino_blog/static/admin/templates/update-password.html @@ -0,0 +1,41 @@ +{% extends "website/templates/base.html" %} +{% load widget_tweaks %} +{% block content %} +{% load static %} + + +


+
+
+

Update Password

+ +
+
Already Registered?
+
Login
+
+
+
+{% endblock %} + diff --git a/arduino_blog/static/admin/templates/user-login.html b/arduino_blog/static/admin/templates/user-login.html new file mode 100644 index 0000000..d0717c0 --- /dev/null +++ b/arduino_blog/static/admin/templates/user-login.html @@ -0,0 +1,74 @@ +{% extends "website/templates/base.html" %} +{% load widget_tweaks %} +{% block content %} +{% load static %} + + +


+
+
+

Sign In

+
+
+
Need new account ?
+
Register
+
+
+ +
+{% endblock %} diff --git a/arduino_blog/static/admin/templates/user-register.html b/arduino_blog/static/admin/templates/user-register.html new file mode 100644 index 0000000..cfa38d9 --- /dev/null +++ b/arduino_blog/static/admin/templates/user-register.html @@ -0,0 +1,108 @@ +{% extends 'website/templates/base.html' %} +{% load widget_tweaks %} +{% load static %} +{% block title %}Register{% endblock %} +{% block cssblock %} + +{% endblock %} +{% block search %} +{% endblock %} +{% block content %} + +
+

Register

+
+
+

The activation link of the account will be sent to the Email id provided.

+
+
{% csrf_token %} +
+
+
+ + {% render_field form.username class+="form-control username" tabindex="1" placeholder="Desired Username" %} +
+ {{ form.username.errors }} +
+
+
+
+
+ + {% render_field form.email class+="form-control email" tabindex="1" placeholder="Your Email" %} +
+ {{ form.email.errors }} +
+
+
+
+
+ + {% render_field form.password class+="form-control password" tabindex="1" placeholder="Enter password" %} +
+ {{ form.password.errors }} +
+
+
+
+
+ + {% render_field form.password_confirm class+="form-control password_confirm" tabindex="1" placeholder="Retype Password" %} +
+ {{ form.password_confirm.errors }} +
+
+
+
+
+ +
+
+
+
+ + +
+ +
+ + +
+


+
+
Already Registered?
+
Login
+
+ + +
+ + +{% endblock %} +{% block uncompressjsblock %} + +{% endblock %} + + diff --git a/arduino_blog/static/admin/templates/view-profile.html b/arduino_blog/static/admin/templates/view-profile.html new file mode 100644 index 0000000..3416928 --- /dev/null +++ b/arduino_blog/static/admin/templates/view-profile.html @@ -0,0 +1,210 @@ +{% extends MODERATOR_ACTIVATED|yesno:'website/templates/moderator/base.html,website/templates/base.html' %} +{% load widget_tweaks %} +{% load static %} +{% load count_tags %} + +{% block title %}User Profile{% endblock %} + +{% block cssblock %} +{% endblock %} + +{% block heading %} + User Profile +{% endblock %} + +{% block content %} + +

+
+

{{profile.user.username}}'s Dashboard

+
+

+ +
+ + + +
+ +
+

+

+
+
+ + +
+
+
+

+
+ +
+ +
+
+
+ + {% if show %} + + + Field required +

Fields required to access basic features of forum
+ {% endif %} + +
+
+
+
+ +
+ +

+

+ + {% for question in questions %} +
+ + {{ question.title }} + +
+ + Asked on:{{ question.date_created }} + +
+ {% endfor %} + +
+

+
+ +
+ +

+

+ + {% for answer in answers%} +
+ + {{ answer.question.title }} + +

+ + Replied on:{{ answer.date_created }} + + +
+ {% endfor %} + +
+

+ +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/arduino_blog/templates/login.html b/arduino_blog/templates/login.html index 052fd99..f9709ab 100644 --- a/arduino_blog/templates/login.html +++ b/arduino_blog/templates/login.html @@ -3,18 +3,18 @@ {% load widget_tweaks %} {% load static %} {% block content %} -
-
+
+

- {% if user and not user.is_anonymous %} -

Submit Proposal

- {% else %} -

Login

- {% endif %} + {% if user and not user.is_anonymous %} +

Submit Proposal

+ {% else %} +

Login

+ {% endif %}

- {% if registration_complete %} + {% if registration_complete %}

Thank You for your registration. You can now log in by clicking here! @@ -22,23 +22,20 @@

- {% endif %} -
- {% csrf_token %} - {{ form.as_p }} - -
-
- Create an Account - - -
-

-
-
- -
+ {% endif %} +
+
+ {% csrf_token %} + {{ form.as_table }} +

+ + Create an Account + +
+

Forgot Password?

+
+
+
{% endblock %} diff --git a/arduino_blog/templates/user-register.html b/arduino_blog/templates/user-register.html index a5282d6..2b2fde6 100644 --- a/arduino_blog/templates/user-register.html +++ b/arduino_blog/templates/user-register.html @@ -5,7 +5,7 @@ {% block content %}
-
+

Sign Up

diff --git a/arduino_projects_website/settings.py b/arduino_projects_website/settings.py index d9e11b9..97dba22 100644 --- a/arduino_projects_website/settings.py +++ b/arduino_projects_website/settings.py @@ -15,6 +15,7 @@ from arduino_projects_website.config import * # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PROJECT_DIR = os.path.abspath(os.path.dirname(__file__) + '/../') # Quick-start development settings - unsuitable for production @@ -57,7 +58,9 @@ ROOT_URLCONF = 'arduino_projects_website.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': ['templates'], + 'DIRS': [PROJECT_DIR + '/static/arduino_blog/templates', + PROJECT_DIR + '/static/admin/templates', + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -123,12 +126,10 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ +MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, "media/") STATIC_URL = '/static/' -STATIC_ROOT = 'arduino_blog/static/' -# STATICFILES_DIRS = [ -# os.path.join(BASE_DIR, "static"), -# '/../static/', -# ] +STATIC_ROOT = os.path.join(BASE_DIR, "static/") MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') MEDIA_URL = "/downloads/" diff --git a/arduino_projects_website/urls.py b/arduino_projects_website/urls.py index ab3eb80..bf94c56 100644 --- a/arduino_projects_website/urls.py +++ b/arduino_projects_website/urls.py @@ -16,10 +16,41 @@ Including another URLconf from django.conf.urls import url from django.contrib import admin from django.urls import include, path, re_path +from django.contrib.auth import views as auth_views urlpatterns = [ url(r'^admin/', admin.site.urls), re_path(r'^', include('arduino_blog.urls', namespace='arduino_blog')), re_path(r'^accounts/', include(('django.contrib.auth.urls', 'auth'), namespace='auth')), + + # URLs for password reset and password change + re_path('^accounts/forgotpassword/', auth_views.PasswordResetView.as_view(\ + template_name= 'registration/password_reset_form.html'),\ + name = "password_reset"), + + re_path(r'^accounts/password_reset/(?P[0-9A-Za-z]+)/(?P.+)/$',\ + auth_views.PasswordResetConfirmView.as_view(\ + template_name= 'registration/password_reset_confirm.html'\ + ), name = 'password_reset_confirm'), + + re_path(r'^accounts/password_reset/mail_sent/', \ + auth_views.PasswordResetDoneView.as_view(template_name= \ + 'registration/password_reset_done.html'),\ + name = 'password_reset_done'), + + re_path(r'^accounts/password_reset/complete/', auth_views.\ + PasswordResetCompleteView.as_view(template_name= \ + 'registration/password_reset_complete.html'),\ + name = 'password_reset_complete'), + + re_path(r'^accounts/changepassword/', auth_views.PasswordChangeView.as_view(\ + template_name='registration/password_change_form.html'\ + ), name = 'password_change'), + + re_path(r'^accounts/password_change/done/', auth_views.\ + PasswordChangeDoneView.as_view(template_name= \ + 'registration/password_change_done.html'),\ + name = 'password_change_done'), + ] -- cgit