Revert "added recaptcha verification"

This reverts commit 7d8fe03b1a.
This commit is contained in:
karthikmv 2022-04-09 22:12:34 +05:30
parent 10edf75891
commit 110234d0ac
4 changed files with 2 additions and 22 deletions

View File

@ -16,15 +16,14 @@ logger = logging.getLogger('db')
IS_COMPENSATION_DETAILS_PDF,
ALLOWED_BRANCH, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
TENTATIVE_DATE_OF_JOINING,
TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS, RECAPTCHA_VALUE
TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS
])
def addPlacement(request):
try:
data = request.data
files = request.FILES
opening = Placement()
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
raise Exception("Recaptcha Failed")
opening.id = generateRandomString()
# Add a company details in the opening
opening.company_name = data[COMPANY_NAME]

View File

@ -117,7 +117,6 @@ OTHER_REQUIREMENTS = 'other_requirements'
DEADLINE_DATETIME = 'deadline_datetime'
OFFER_ACCEPTED = 'offer_accepted'
EMAIL_VERIFIED = 'email_verified'
RECAPTCHA_VALUE = 'recaptchakey'
STUDENT_LIST = "student_list"
STUDENT_ID = "student_id"

View File

@ -19,7 +19,6 @@ from google.auth.transport import requests
from google.oauth2 import id_token
from rest_framework import status
from rest_framework.response import Response
import requests as rq
from .constants import *
from .models import User, PrePlacementOffer, PlacementApplication
@ -234,18 +233,3 @@ def generateOneTimeVerificationLink(email, opening_id, opening_type):
print(sys.exc_info())
logger.warning("Utils - generateOneTimeVerificationLink: " + str(sys.exc_info()))
return False, "_"
def verify_recaptcha(request):
try:
data = {
'secret': settings.RECAPTCHA_SECRET_KEY,
'response': request
}
r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data)
result = r.json()
# logger.info("Recaptcha Response: " + str(result)+"request: "+str(data))
return result['success']
except:
print(sys.exc_info())
logger.warning("Utils - verify_recaptcha: " + str(sys.exc_info()))
return False, "_"

View File

@ -161,8 +161,6 @@ EMAIL_PORT = 587
EMAIL_HOST_USER = os.environ.get("EMAIL") # 'email here'
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_PASSWORD") # 'password here'
RECAPTCHA_SECRET_KEY = os.environ.get("RECAPTCHA_SECRET_KEY")
LOGGING = {
'version': 1,
'disable_existing_loggers': False,