adilmohak / django-lms

A learning management system using django web framework. Course add and drop, grade and assessment result management, online quiz, report generator, student and lecturers management, dashboard, and so much more...
MIT License
568 stars 244 forks source link

Login form not working when new Student is added from admin panel #36

Open AdanNazir opened 6 months ago

AdanNazir commented 6 months ago

So here's the deal, whenever I add a new student from admin panel and fill their details, then when I use their username and password in the login section of the website, it displays "Invalid ID and password", can you please check this out and see if its a bug or if I'm doing anything wrong? Thanks!

adilmohak commented 4 months ago

The form now sends an email containing auto-generated credentials to students and lecturers immediately when the admin creates one. So to log in you have to get the ID and password from their email.

One tip, do not use the django-admin panel to create students or lecturers as the auto-generated credentials functionality is not supported there.

adilmohak commented 4 months ago

But we'll definitely consider supporting the same functionality on the django-admin panel

MHassan1122 commented 3 months ago

then from where we can obtain the student or lecturer password

mnymkr commented 2 months ago

The form now sends an email containing auto-generated credentials to students and lecturers immediately when the admin creates one. So to log in you have to get the ID and password from their email.

One tip, do not use the django-admin panel to create students or lecturers as the auto-generated credentials functionality is not supported there.

Hey I just checked with a real email account and there is no credentials sent after creating a new account. Perhaps this functionality has not been implemented yet?

adilmohak commented 2 months ago

Have you started your celery worker?

mnymkr commented 2 months ago

I have now, and this error appears: [2024-07-12 07:03:40,258: INFO/MainProcess] Task accounts.tasks.send_new_lecturer_email[501d8802-b337-4790-be4c-c17788b337e6] received [2024-07-12 07:03:40,269: ERROR/ForkPoolWorker-8] Task accounts.tasks.send_new_lecturer_email[501d8802-b337-4790-be4c-c17788b337e6] raised unexpected: DoesNotExist('User matching query does not exist.') Traceback (most recent call last): File "/home/mnymkr/.local/share/virtualenvs/django-lms-e1W7avmb/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task R = retval = fun(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "/home/mnymkr/.local/share/virtualenvs/django-lms-e1W7avmb/lib/python3.12/site-packages/celery/app/trace.py", line 736, in __protected_call__ return self.run(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mnymkr/Projects/mi-clones/django-lms/accounts/tasks.py", line 19, in send_new_lecturer_email user = get_user_model().objects.get(pk=user_pk) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mnymkr/.local/share/virtualenvs/django-lms-e1W7avmb/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mnymkr/.local/share/virtualenvs/django-lms-e1W7avmb/lib/python3.12/site-packages/django/db/models/query.py", line 649, in get raise self.model.DoesNotExist( accounts.models.User.DoesNotExist: User matching query does not exist.

mnymkr commented 2 months ago

Okay now I keep getting SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. For more information, go to\n5.7.8 https://support.google.com/mail/?p=BadCredentials d9443c01a7336-1fbb6ace7d9sm61674865ad.251 - gsmtp') despite having created an app password for my account and putting it in the .env file. Can you show how you managed to get smtplib to authenticate?