Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/account/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.3 on 2023-08-17 00:31
# Generated by Django 4.2.3 on 2023-08-17 00:55

import django.contrib.auth.models
import django.contrib.auth.validators
Expand Down
4 changes: 2 additions & 2 deletions server/account/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.3 on 2023-08-17 00:31
# Generated by Django 4.2.3 on 2023-08-17 00:55

from django.db import migrations, models

Expand All @@ -8,8 +8,8 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('vote', '0001_initial'),
('account', '0001_initial'),
('vote', '0001_initial'),
]

operations = [
Expand Down
3 changes: 2 additions & 1 deletion server/account/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def signup(request):
form = SignupForm(request.POST)
if form.is_valid():
user = form.save()
user.custom_active=False
auth.login(request, user)
pk=str(user.pk)
return redirect(f'/account/email_verification/{user.pk}/')
Expand Down Expand Up @@ -130,7 +131,7 @@ def call(request):
code = request.POST.get('code') # Get the code from the form submission
token = request.POST.get('token')
if token == code:
request.user.is_active = True
request.user.custom_active = True
request.user.save()
return redirect("account:login") # Redirect to login page after successful verification
else:
Expand Down
2 changes: 1 addition & 1 deletion server/vote/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.3 on 2023-08-17 00:31
# Generated by Django 4.2.3 on 2023-08-17 00:55

from django.conf import settings
from django.db import migrations, models
Expand Down
7 changes: 6 additions & 1 deletion server/vote/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

# 메인페이지
def main(request):
user=request.user
if user.is_authenticated and user.custom_active==False:
print(34)
authentication_url = reverse("account:email_verification", args=[user.id])
return redirect(authentication_url)
polls = Poll.objects.all()
sort = request.GET.get("sort")
promotion_polls = Poll.objects.filter(active=True).order_by("-pub_date")[:3]
Expand Down Expand Up @@ -386,7 +391,7 @@ def calcstat(request, poll_id, uservote_id, nonuservote_id):
if (poll_result.choice1_man + poll_result.choice2_man) != 0
else 0
)
choice2_man_percentage = (
choice2_man_percentage = (
(
np.round(
poll_result.choice2_man
Expand Down