From 35ddf1d1f716a646ce1012e3750af85c1e0a668b Mon Sep 17 00:00:00 2001 From: YashSahsani Date: Fri, 21 Jun 2024 17:05:05 -0400 Subject: [PATCH 1/3] fix: auth bugs --- Auth/templates/Auth/base.html | 27 +++--- Auth/templates/Auth/forgot_password.html | 29 +++--- Auth/templates/Auth/login.html | 60 +++++++------ Auth/templates/Auth/reset_password.html | 52 ++++++++--- Auth/templates/Auth/signup.html | 108 ++++++++++++++++++----- Auth/views.py | 18 ++-- 6 files changed, 195 insertions(+), 99 deletions(-) diff --git a/Auth/templates/Auth/base.html b/Auth/templates/Auth/base.html index 0288768..0db35d0 100644 --- a/Auth/templates/Auth/base.html +++ b/Auth/templates/Auth/base.html @@ -1,6 +1,7 @@ {% load static %} + @@ -8,22 +9,24 @@ + -{% include 'alert.html' %} + {% include 'alert.html' %} -
-
- -
- {% block content %} - {% endblock %} +
+
+ +
+ {% block content %} + {% endblock %} +
-
- + - + + \ No newline at end of file diff --git a/Auth/templates/Auth/forgot_password.html b/Auth/templates/Auth/forgot_password.html index 753f99f..cfdb311 100644 --- a/Auth/templates/Auth/forgot_password.html +++ b/Auth/templates/Auth/forgot_password.html @@ -3,17 +3,22 @@ {% block title %}GreenCart | Forgot password?{% endblock %} {% block content %} -

Forgot your password?

-
- {% csrf_token %} -
- {{ form.email.label_tag }} - {{ form.email }} -
-
- -
-
-

Remembered your password? Sign in

+

Forgot your password?

+
+ {% csrf_token %} +
+ + {{ form.email }} +
+
+ +
+
+

Remembered your password? Sign in

{% endblock %} \ No newline at end of file diff --git a/Auth/templates/Auth/login.html b/Auth/templates/Auth/login.html index 0b0a830..a9faf5a 100644 --- a/Auth/templates/Auth/login.html +++ b/Auth/templates/Auth/login.html @@ -1,31 +1,39 @@ -{% extends 'Auth/base.html' %} +{% extends 'Auth/base.html' %} {% block title %}GreenCart | Login{% endblock %} {% block content %} -

Welcome Back

-
- {% csrf_token %} -
- {{ form.email.label_tag }} - {{ form.email }} -
-
- {{ form.password.label_tag }} - {{ form.password }} -
-
-
- {{ form.remember_me }} - {{ form.remember_me.label_tag }} -
- -
-
- -
-
-

Don't have an account? Sign up

+

Welcome Back

+
+ {% csrf_token %} +
+ + {{ form.email }} +
+
+ + {{ form.password }} +
+
+
+ {{ form.remember_me }} + {{ form.remember_me.label_tag }} +
+ +
+
+ +
+
+

Don't have an account? Sign up

{% endblock %} \ No newline at end of file diff --git a/Auth/templates/Auth/reset_password.html b/Auth/templates/Auth/reset_password.html index 9f06b6c..aa75b68 100644 --- a/Auth/templates/Auth/reset_password.html +++ b/Auth/templates/Auth/reset_password.html @@ -3,20 +3,44 @@ {% block title %}GreenCart | Reset Password{% endblock %} {% block content %} -

Reset Password

-
- {% csrf_token %} - {{ form.email }} -
- {{ form.password1.label_tag }} - {{ form.password1 }} +

Reset Password

+ + {% csrf_token %} + {{ form.email }} +
+ + {{ form.password1 }} + {% if form.password1.errors %} +
+
    + {% for error in form.password1.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
-
- {{ form.password2.label_tag }} - {{ form.password2 }} -
-
- + {% endif %} + +
+
+ + {{ form.password2 }} + {% if form.password2.errors %} +
+
    + {% for error in form.password2.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
- + {% endif %} +
+
+ +
+ {% endblock %} \ No newline at end of file diff --git a/Auth/templates/Auth/signup.html b/Auth/templates/Auth/signup.html index 3390513..6be67c9 100644 --- a/Auth/templates/Auth/signup.html +++ b/Auth/templates/Auth/signup.html @@ -2,32 +2,92 @@ {% block title %}GreenCart | Signup{% endblock %} {% block content %} -

Create Your Account

-
- {% csrf_token %} -
- {{ form.first_name.label_tag }} - {{ form.first_name }} +

Create Your Account

+ + {% csrf_token %} +
+ + {{ form.first_name }} + {% if form.first_name.errors %} +
+
    + {% for error in form.first_name.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
-
- {{ form.last_name.label_tag }} - {{ form.last_name }} + {% endif %} +
+
+ + {{ form.last_name }} + {% if form.last_name.errors %} +
+
    + {% for error in form.last_name.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
-
- {{ form.email.label_tag }} - {{ form.email }} + {% endif %} +
+
+ + {{ form.email }} + {% if form.email.errors %} +
+
    + {% for error in form.email.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
-
- {{ form.password1.label_tag }} - {{ form.password1 }} -
-
- {{ form.password2.label_tag }} - {{ form.password2 }} + {% endif %} +
+
+ + + {{ form.password1 }} + {% if form.password1.errors %} +
+
    + {% for error in form.password1.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
-
- + {% endif %} +
+
+ + {{ form.password2 }} + {% if form.password2.errors %} +
+
    + {% for error in form.password2.errors %} +
  • {{ error|escape }}
  • + {% endfor %} +
- -

Already have an account? Sign in

-{% endblock %} + {% endif %} +
+ +
+ +
+ +

Already have an account? Sign in

+{% endblock %} \ No newline at end of file diff --git a/Auth/views.py b/Auth/views.py index 60c6924..03faece 100644 --- a/Auth/views.py +++ b/Auth/views.py @@ -7,6 +7,8 @@ from .backend import getSecondsOfOneYear from .models import User from django.urls import reverse +from django.http import HttpResponse + @@ -50,10 +52,10 @@ def post(self, request): messages.success(request, 'Account created successfully') return redirect('Auth:login') else: - print(form.errors) - messages.error(request, 'Please check your inputs') - return redirect('Auth:signup', {'form': form}) - + response = HttpResponse() + response['Location'] = '/auth/signup/' + response = render(request, 'Auth/signup.html', {'form': form},status=400) + return response def forgot_password(request): form = ForgotPasswordForm() @@ -69,15 +71,12 @@ def forgot_password(request): def reset_password(request): email = request.GET.get('email') - print("email:"+str(email)) + form = ResetPasswordForm(email=email) if not email: messages.error(request, 'Invalid password reset link.') return redirect('forgot_password') - print(request.method) if request.method == 'POST': form = ResetPasswordForm(request.POST, email=email) - print("form:"+str(form.is_valid())) - print("form:"+str(form.errors)) if form.is_valid(): user = User.objects.filter(email=email).first() print("user:"+str(user)) @@ -88,9 +87,6 @@ def reset_password(request): print("saved:") messages.success(request, 'Your password has been successfully reset.') return redirect(reverse('Auth:login')) - else: - form = ResetPasswordForm(email=email) - return render(request, 'Auth/reset_password.html', {'form': form}) From d989fed3d12ea9fa18646ae54cc7efae538241cc Mon Sep 17 00:00:00 2001 From: YashSahsani Date: Fri, 21 Jun 2024 17:15:08 -0400 Subject: [PATCH 2/3] fix: update requirments --- requirements.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/requirements.txt b/requirements.txt index 47adba6..7d99c10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,16 @@ asgiref==3.8.1 +astroid==3.2.2 +dill==0.3.8 Django==4.2.13 +gunicorn==22.0.0 +isort==5.13.2 +mccabe==0.7.0 +packaging==24.1 +platformdirs==4.2.2 +pylint==3.2.3 +pylint-django==2.5.5 +pylint-plugin-utils==0.8.2 sqlparse==0.5.0 +tomli==2.0.1 +tomlkit==0.12.5 typing_extensions==4.12.2 From 09d680b8b24af8dc7245c132c3207fbfea9730e9 Mon Sep 17 00:00:00 2001 From: Hetvi2010 Date: Fri, 21 Jun 2024 22:30:00 -0400 Subject: [PATCH 3/3] feat: landing page horizontal scroll (carousel) --- GreenCartEcom/templates/Dashboard/index.html | 87 +++++++++++++++++-- GreenCartEcom/templates/Dashboard/navbar.html | 32 ++++++- templates/footer.html | 42 ++++----- 3 files changed, 128 insertions(+), 33 deletions(-) diff --git a/GreenCartEcom/templates/Dashboard/index.html b/GreenCartEcom/templates/Dashboard/index.html index 2e7cd2e..5518210 100644 --- a/GreenCartEcom/templates/Dashboard/index.html +++ b/GreenCartEcom/templates/Dashboard/index.html @@ -1,15 +1,84 @@ {% extends 'Dashboard/navbar.html' %} {% block title %}GreenCart | Dashboard{% endblock %} {% block content %} - + + + +
+
+ 1st image + 1st image + 1st image + 1st image + 1st image + 1st image +
+ + + {% endblock %} \ No newline at end of file diff --git a/GreenCartEcom/templates/Dashboard/navbar.html b/GreenCartEcom/templates/Dashboard/navbar.html index bee25af..de93310 100644 --- a/GreenCartEcom/templates/Dashboard/navbar.html +++ b/GreenCartEcom/templates/Dashboard/navbar.html @@ -8,8 +8,18 @@ {% block title %}{% endblock %} + - + +
{% include 'alert.html' %}
+ + -
+ +
{% block content %} {% endblock %} + + + {% include 'footer.html' %}
- {% include 'footer.html' %} + diff --git a/templates/footer.html b/templates/footer.html index a8359e7..169c721 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -1,24 +1,24 @@ -