Skip to content

updates of G2 pair 1#79

Open
Gowwwthami wants to merge 4 commits into
FusionIIIT:mainfrom
Gowwwthami:optimize-20260508
Open

updates of G2 pair 1#79
Gowwwthami wants to merge 4 commits into
FusionIIIT:mainfrom
Gowwwthami:optimize-20260508

Conversation

@Gowwwthami
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 8, 2026 17:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates parts of the Django REST API around role retrieval/updating and email/password helper behavior, mainly focusing on query efficiency and safer defaults.

Changes:

  • Optimize designation ID retrieval using values_list and remove a debug print.
  • Make send_email default arguments safer and guard mail_to_user against empty inputs.
  • Minor query cleanup in add_student_info (.filter(...) instead of .all().filter(...)).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Backend/backend/api/views.py Role lookup optimized; debug output removed; exception handling updated in password reset flow.
Backend/backend/api/helpers.py send_email signature updated; mail_to_user guarded for empty input; minor queryset cleanup.
Comments suppressed due to low confidence (1)

Backend/backend/api/helpers.py:131

  • mail_to_user currently sends the same hard-coded password ("user@123") to every created user. This is a credential-reuse risk and makes account takeover easier if any password leaks. Suggestion: generate a unique initial password per user (reusing the existing password-generation helpers) and ensure the stored hashed password matches what is emailed.
        max_threads = min(10, len(created_users))
        with concurrent.futures.ThreadPoolExecutor(max_workers=max_threads) as executor:
            future_to_user = [
                executor.submit(mail_to_user_single, user, "user@123") for user in created_users
            ]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Backend/backend/api/views.py Outdated
Comment on lines 198 to 201
except Exception as e:
print(e)
finally:
return Response({"password": new_password,"message": "Password reset successfully."}, status=status.HTTP_200_OK)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Comment thread Backend/backend/api/views.py Outdated
Comment on lines 188 to 192
batch = int(row[7]) if row[7] else datetime.now().year
batch_id = Batch.objects.all().filter(name = row[8], discipline__acronym = extrainfo.department.name, year = batch)
batch_id = Batch.objects.filter(name = row[8], discipline__acronym = extrainfo.department.name, year = batch)
data = {
'id' : extrainfo.id,
'programme' : row[8] if row[8] else 'B.Tech',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@vikrantwiz02 vikrantwiz02 self-requested a review May 8, 2026 17:39
…xt password storage in reset, fix mail handler crash on ORM input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants