Allow CID users to request details by email
This commit is contained in:
@@ -90,6 +90,7 @@ urlpatterns = [
|
||||
path("cid/<int:cid>/", views.cid_scores_admin, name="cid_scores_admin"),
|
||||
path("user/scores", views.user_scores, name="user_scores"),
|
||||
path("cid/", views.cid_selector, name="cid_selector"),
|
||||
path("cid/request_cid_details/", views.request_cid_details, name="request_cid_details"),
|
||||
# Global url that registers RTS compatible exams
|
||||
path("exam/json/", views.active_exams, name="active_exams"),
|
||||
path(
|
||||
|
||||
@@ -11,6 +11,9 @@ from django.shortcuts import render, get_object_or_404, redirect
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django import forms
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import validate_email
|
||||
|
||||
from django.utils.html import format_html
|
||||
|
||||
# from django.contrib.auth.models import User
|
||||
@@ -724,3 +727,20 @@ def accounts_bulk_create(request):
|
||||
return render(request, "accounts_bulk_create.html", context)
|
||||
else:
|
||||
return render(request, "accounts_bulk_create.html", {})
|
||||
|
||||
|
||||
def request_cid_details(request):
|
||||
email = request.POST.get("email")
|
||||
try:
|
||||
validate_email(email)
|
||||
except ValidationError as e:
|
||||
return HttpResponse("Invalid email.")
|
||||
|
||||
cid_users = CidUser.objects.filter(email=email)
|
||||
|
||||
for cid_user in cid_users:
|
||||
cid_user.email_details(resend=True)
|
||||
cid_user.email_details()
|
||||
|
||||
|
||||
return HttpResponse("Candidate details will be sent to the requested email (if it is found in the system).")
|
||||
|
||||
Reference in New Issue
Block a user