Comments (6)
Actually this project is still under development and the problem you are facing is because of POST
request being generated from the client side but it is not done in the proper way in this project.
Just replace all the POST
requests in all the JavaScripts (/home/static/scripts)
Files with GET
requests i.e. make changes like this:
change
...
$.ajax(
{
type:"POST",
url: ...,
data: ...,
to
...
$.ajax(
{
type:"GET",
url: ...,
data: ...,
This will work fine. But sending data through GET
requests have security issues so try to implement this using POST
requests on your own.
.. I cant find another way to connect to you ...
To contact me you just could check out my profile, that is not that hard.
from voting-system-using-block-chain.
@akverma26 as you mentioned I changed all POST to GET and still getting the same error. how to overcome this issue
from voting-system-using-block-chain.
Add this @csrf_exempt statement above the authentication() method in views.py file.
Code :
@csrf_exempt
--------------- Authentication -------------------
def authentication(request):
voter = ""
aadhar_no = request.POST.get('aadhar_no')
print("Aadhar Number",aadhar_no)
details = {'success': False}
# try:
try:
voter = Voters.objects.get(uuid = aadhar_no)
print(voter)
request.session['uuid'] = aadhar_no
except:
render_html = loader.render_to_string('candidate_details.html')
try:
if voter.vote_done:
details = {
'error': 'You have already casted your vote.'
}
else:
details = {
'success': True,
'html': render_html,
'details': model_to_dict(voter)
}
except:
details = {
'success': True,
'html': render_html,
'details': ""
}
# except:
# details = {
# 'error': 'Invalid Aadhar, Please Enter Correct Aadhar Number!'
# }
return JsonResponse(details)
This code work for me
from voting-system-using-block-chain.
@Tushu-14 placing @csrf_exempt as you said got error like this
[ from . import views
File "/home/sarigha/Downloads/Voting-System-using-Block-Chain-Technology-master/home/views.py", line 24, in <module>
@csrf_exempt
NameError: name 'csrf_exempt' is not defined]
from voting-system-using-block-chain.
from voting-system-using-block-chain.
@akverma26 as you mentioned I changed all POST to GET and still getting the same error. how to overcome this issue
Change POST to GET in server code as well.
Eg:
Wherever you see in code request.POST
change it to request.GET
this might solve the issue
I'm closing this issue, feel free to reopen or create new issue when you face any issue.
from voting-system-using-block-chain.
Related Issues (8)
- authenticate HOT 5
- Password HOT 1
- INVALID AADHAAR HOT 1
- access HOT 1
- Access HOT 1
- csrf error
- Will try for fyp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voting-system-using-block-chain.