CSRF ACTUALLY fixed, branches mixed up previously

This commit is contained in:
admin committed 2022-06-16 13:55:23 -04:00
1 parent dcf2f56177
commit fcfc7416a5
7 files changed
+14 -10

No files matched your search

Binary file not shown.
+1 -2
View File
@@ -36,9 +36,8 @@ def home(request):
return render(request, 'home.html', context) return render(request, 'home.html', context)
@cache_page(CACHE_TTL) #@cache_page(CACHE_TTL)
def about(request): def about(request):
form = SubscribersForm(request.POST)
if request.method == 'POST': if request.method == 'POST':
form = SubscribersForm(request.POST) form = SubscribersForm(request.POST)
if form.is_valid(): if form.is_valid():
+7 -3
View File
@@ -29,7 +29,7 @@ DEBUG = False
ADMINS = [('Matteo', 'clichemail1@gmail.com')] ADMINS = [('Matteo', 'clichemail1@gmail.com')]
#ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]', '23.92.22.47:8000'] #ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]', '23.92.22.47:8000']
ALLOWED_HOSTS = ['23.92.22.47', 'localhost'] ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'wvlotterypredictor.xyz','www.wvlotterypredictor.xyz']
# Application definition # Application definition
@@ -47,6 +47,7 @@ INSTALLED_APPS = [
#'ckeditor', #'ckeditor',
'crispy_forms', 'crispy_forms',
'django.contrib.sitemaps', 'django.contrib.sitemaps',
'corsheaders',
#'django.contrib.sites', #'django.contrib.sites',
#'django_cleanup.apps.CleanupConfig', #'django_cleanup.apps.CleanupConfig',
] ]
@@ -56,6 +57,7 @@ SITE_ID = 1
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -65,8 +67,10 @@ MIDDLEWARE = [
] ]
ROOT_URLCONF = 'lottopy_site.urls' ROOT_URLCONF = 'lottopy_site.urls'
SESSION_COOKIE_SECURE = os.getenv('SESSION_COOKIE_SECURE_ENABLED') != 'False' SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = os.getenv('CSRF_COOKIE_SECURE_ENABLED') != 'False' CSRF_COOKIE_SECURE = True
CSRF_TRUSTED_ORIGINS = ['https://wvlotterypredictor.xyz', 'https://www.wvlotterypredictor.xyz']
CORS_ALLOW_ALL_ORIGINS = True
# Templates Directory # Templates Directory
TEMPLATE_DIR = os.path.join(BASE_DIR,"templates") TEMPLATE_DIR = os.path.join(BASE_DIR,"templates")
+4 -4
View File
@@ -5,11 +5,11 @@
<h1 class="text-white">About this site</h1> <h1 class="text-white">About this site</h1>
<div class="container bg-light rounded-3"> <div class="container bg-light rounded-3">
<body> <body>
<p>This site was made initally as a project to familiarize myself with the web framework Django, and to publicly make available a program I had written to find the most likely lottery combinations.</p> <p>This site was made initally as a project to familiarize myself with the web framework Django, and to publicly make available a program I had written to find the most likely lottery combinations. It is <b>NOT</b> in affiliation with the West Virginia State Lottery although they are listed above to help confirm winning numbers.</p>
<p>It began when two close friends of mine piqued my interest with their own ways to win the jackpot. One who thought it was all in location, and another who simply pulled numbers from his dreams and meditation (some winning +$10,000!)</p> <p>It began when two close friends of mine piqued my interest with their own ways to win the jackpot. One who thought it was all in location, and another who simply pulled numbers from his dreams and meditation (some winning +$10,000!)</p>
<p>Although I do not claim to have a universal link or the secret to winning numbers, my goal is to give the best edge available using statistical and historical analysis on the lottery.</p> <p>Although I do not claim to have a universal link or the secret to winning numbers, my goal is to give the best edge available using statistical and historical analysis on the lottery.</p>
<p>The site is still in development and I am working on adding more features and improving the site's functionality.</p> <p>The site is still in development and I am working on adding more features and improving the site's functionality.</p>
<p>I am also currently working on cleaning and refactoring the code involved as to open source it and allow others to make their own winning number generator for their state.</p> <p>I have created a cleaned and stripped down version of the scripts involved and they are hosted <a href="https://www.github.com/lottopy/wvlottopy">here.</a> I encourage anyone interested to port it to their own local lotteries.</p>
<p>If you have any suggestions or comments, please feel free to contact me at <u style="color:blue">admin at wvlotterypredictor dot xyz</u> and please keep in mind this site is funded by the donations of those who support it, so any financial assistance is greatly appreciated.</p> <p>If you have any suggestions or comments, please feel free to contact me at <u style="color:blue">admin at wvlotterypredictor dot xyz</u> and please keep in mind this site is funded by the donations of those who support it, so any financial assistance is greatly appreciated.</p>
<p>For updates subscribe to the mailing list at the bottom of this page (I will not disclose or abuse your personal information) or follow me on the twitter linked in the navigation bar. Thank you for visiting!</p> <p>For updates subscribe to the mailing list at the bottom of this page (I will not disclose or abuse your personal information) or follow me on the twitter linked in the navigation bar. Thank you for visiting!</p>
<h2><i class="fa-solid fa-wallet"></i>Crypto Addresses</h2> <h2><i class="fa-solid fa-wallet"></i>Crypto Addresses</h2>
@@ -30,11 +30,11 @@
</body> </body>
</div> </div>
<div class="container bg-light rounded-3"> <div class="container bg-light rounded-3">
<!--{% for message in messages %} {% for message in messages %}
<div class='alert alert-success'> <div class='alert alert-success'>
{{ message }} {{ message }}
</div> </div>
{% endfor %}--> {% endfor %}
<h5>Subscribe to Newsletter</h5> <h5>Subscribe to Newsletter</h5>
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
+2 -1
View File
@@ -4,9 +4,10 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="format-detection" content="telephone=no"/> <meta name="format-detection" content="telephone=no"/>
<meta name="theme-color" content="black">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" property="og:description" content="A site created to predict winning West Virginia Lottery numbers" /> <meta name="description" property="og:description" content="A site created to predict winning West Virginia Lottery numbers" />
<meta name="keywords" content="West Virginia, Lottery, Predictions, Numbers, Winning, how, to, win, thw, lottery, free, generator, edge, best" /> <meta name="keywords" content="West Virginia, Lottery, Predictions, Numbers, Winning, how, to, win, the, lottery, free, generator, edge, best, wv, predictor, WV, west, viriginia" />
<meta name="author" content="Matteo DiBiagio" /> <meta name="author" content="Matteo DiBiagio" />
{% if title %} {% if title %}
<title>WV Lottery Predictor | {{title}} </title> <title>WV Lottery Predictor | {{title}} </title>