coding-geek21 / classDeck

ClassDeck Online Classroom for students and teachers. ClassDeck aims to create an all in one online classroom platform where Students can attend exams view results, view assignments, submit assignments and do more. Teachers can post tests and view the results as well as post assignments and videos etc.
https://classdeck.herokuapp.com/
MIT License
13 stars 52 forks source link

Issue #46 Forgot password feature #58

Closed m-a-rahul closed 2 years ago

m-a-rahul commented 2 years ago

Fixes: #46

Description

Built custom templates with UI features relating to the ClassDeck's classic structure, on top of django.contrib.auth.views which offers default authentication feature by also handling form errors.

Type of change

How Has This Been Tested?

The feature has been tested across multiple times and is completely error free as we have just customised the default django package.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

password_reset_email.html

line no 5: {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} <- Production (commented)
line no 6: http://localhost:8000{% url 'password_reset_confirm' uidb64=uid token=token %} <- Development (active)

Checklist:

Screenshots

Successfull Testcase

image image image image image

Invalid token

(If an attacker tries with another token and access the URL or if the same token is used twice)

image

yaswanthsaivendra commented 2 years ago

@m-a-rahul Usually when we have differentiating stuff b/w development & prod code, its better make use of a simple if-else rather than commenting stuff. What we can do is just make use of DEBUG constant with if statement and check whether if its set to true then implement the dev. code else prod. code.

m-a-rahul commented 2 years ago

Ok cool, got your suggestions. Will write back asap on completion of the changes requested.

m-a-rahul commented 2 years ago

Fixes after the previous set of suggestions

Fix 1

Corresponding bug: Password Update Failure Description: Cause -> Since an AbstractUser model is configured on top of the default Users model the password update didn't work. Fix -> Built a custom form on top SetPasswordForm, which handles this functionality in the Django package

Fix 2

Corresponding bug: Email Check Description: Cause -> Django's default form doesn't inherit the functionality. Fix -> Built a custom form on top PasswordResetForm, which handles this functionality in the Django package

Screenshot: image

Fix 3

Corresponding bug: Domain name in dev and prod env Description: Cause -> Django uses the sites framework to capture the domain Fix -> Wrote a condition to change the domain key value to,

Screenshot: sketchpad pro_F4E6D533E0B94758D48