1212from email .mime .multipart import MIMEMultipart
1313from email .mime .text import MIMEText
1414from time import sleep
15-
15+ from validate_email import validate_email
1616import numpy as np
1717import psutil
1818import requests
@@ -457,7 +457,7 @@ def xss(request):
457457 }
458458 if request .method == 'POST' :
459459 input_str = request .POST .get ("string" )
460- if input_str is not None and input_str is not '' :
460+ if input_str is not None and input_str is not '' :
461461 d ['msg' ] = input_str [::- 1 ]
462462 return render (request , 'xss.html' , d )
463463
@@ -778,7 +778,7 @@ def csrf(request):
778778 d ['complete' ] = True
779779 except Exception as e :
780780 logger .exception ('Exception occurs: %s' , e )
781- d ['msg ' ] = _ ('msg.passwd.change.failed' )
781+ d ['errmsg ' ] = _ ('msg.passwd.change.failed' )
782782 return render (request , 'csrf.html' , d )
783783
784784
@@ -793,7 +793,7 @@ def clickjacking(request):
793793 if request .method == 'POST' and "username" in request .session :
794794 username = request .session ["username" ]
795795 mail = request .POST .get ("mail" )
796- if mail is not None :
796+ if validate_email ( mail ) :
797797 try :
798798 from django .contrib .auth .models import User
799799 User .objects .filter (is_superuser = True )
@@ -803,7 +803,9 @@ def clickjacking(request):
803803 d ['complete' ] = True
804804 except Exception as e :
805805 logger .exception ('Exception occurs: %s' , e )
806- d ['msg' ] = _ ('msg.mail.change.failed' )
806+ d ['errmsg' ] = _ ('msg.mail.change.failed' )
807+ else :
808+ d ['errmsg' ] = _ ('msg.mail.format. is.invalid' )
807809 return render (request , 'clickjacking.html' , d )
808810
809811
0 commit comments