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
Empty file added ServerCTF/accounts/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions ServerCTF/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin
from . import models

# Register your models here.
admin.site.register(models.Users)
5 changes: 5 additions & 0 deletions ServerCTF/accounts/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AccountsConfig(AppConfig):
name = 'accounts'
24 changes: 24 additions & 0 deletions ServerCTF/accounts/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from . import models

class RegisterForm(forms.ModelForm) :
username = forms.CharField(max_length=250, label="User Name")
email = forms.EmailField(max_length=250, label="Email", widget=forms.TextInput(attrs={'type':'email'}))
password = forms.CharField(max_length=250, min_length=8, label="Password", widget=forms.TextInput(attrs={'type':'password'}))

class Meta :
model = models.Users
fields = ["username","email"]

class LoginForm(AuthenticationForm) :
username = forms.CharField(max_length=50, label="User Name")
password = forms.CharField(max_length=250, min_length=8, label="Password", widget=forms.TextInput(attrs={'type':'password'}))

class UpdateTeamDetails(forms.ModelForm) :
job = forms.CharField(max_length=250, label="Job", required=False)
company = forms.CharField(max_length=250, label="Company", required=False)

class Meta :
model = models.Users
fields = ["job","company"]
Empty file.
10 changes: 10 additions & 0 deletions ServerCTF/accounts/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.db import models

# Create your models here.

class Users(models.Model) :
username = models.CharField(max_length=250, primary_key=True)
email = models.EmailField(max_length=250, unique=True)
job = models.CharField(max_length=100, null=True, default="")
company = models.CharField(max_length=250, null=True, default="")
points = models.IntegerField(default=0)
59 changes: 59 additions & 0 deletions ServerCTF/accounts/static/css/profile.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#updateForm {
margin: 5% auto;
width: 600px;
max-width: 100%;
box-shadow: 0px 0px 16px 8px rgba(0,0,0,0.5);
padding: 20px;
}

input[type=text] {
background-color: #dcdcdc;
margin-bottom: 20px;
border: 0;
width: 100%;
padding: 10px;
margin-top: 2px;
box-sizing: border-box;
}

input[type=text]:focus {
border: 2px solid #a3d39c;
background-color: #fff;
}

label {
margin-left: 10px;
color: #444;
}

.updateFormButton {
border: 0;
color: #222;
background-color: #fff;
width: 100px;
height: 40px;
border: 2px solid #444;
transition-duration: 0.5s;
}

.updateFormButton:hover {
background-color: #444;
color: #fff;
}

#formSuccess, #formFailure {
width: 100%;
height: 50px;
text-align: center;
line-height: 50px;
vertical-align: middle;
background-color: #4caf50;
font-size: 16px;
color: #fff;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
margin-bottom: 5%;
}

#formFailure {
background-color: #f44336;
}
71 changes: 71 additions & 0 deletions ServerCTF/accounts/static/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#register {
width: 400px;
max-width: 100%;
height: auto;
margin: 5% auto;
box-shadow: 0px 0px 16px 8px rgba(0,0,0,0.5);
padding: 20px;
}

.registerTop {
width: 100%;
}

.registerTop td {
width: 50%;
text-align: center;
height: 60px;
font-size: 20px;
color: #444;
border: 1px solid #888;
transition: 0.5s;
font-weight: bold;
}

.registerForm {
margin-top: 20px;
}

table {
width: 100%;
}

span {
display: inline-block;
width: 100%;
}

input[type="text"], input[type="password"], input[type=email] {
background-color: #dcdcdc;
margin-bottom: 20px;
border: 0;
width: 100%;
padding: 10px;
margin-top: 2px;
box-sizing: border-box;
}

input[type=text]:focus, input[type="password"]:focus, input[type=email]:focus {
border: 2px solid #a3d39c;
background-color: #fff;
}

label {
margin-left: 10px;
color: #444;
}

.submitButton {
width: 100px;
height: 40px;
font-size: 20px;
border: 2px solid #444;
color: #222;
background-color: #fff;
transition: 0.5s;
}

.submitButton:hover {
color: #fff;
background-color: #444;
}
15 changes: 15 additions & 0 deletions ServerCTF/accounts/static/css/team.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#team_details {
margin-top: 5%;
text-align: center;
font-size: 20px;
margin-bottom: 5%;
}

#solved_challenges h3 {
text-align: center;
}

#solved_challenges p {
text-align: center;
font-size: 20px;
}
19 changes: 19 additions & 0 deletions ServerCTF/accounts/templates/profile/change-password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'navigationbar.html' %}

{% block title %}
<title>Change password</title>
{% endblock %}

{% block custombody %}

<div class="container">
<div id="update-password" style="margin-top: 10%">
<form method="post">
{% csrf_token %}
{{ form }}
<button type="submit">Save Changes</button>
</form>
</div>
</div>

{% endblock %}
51 changes: 51 additions & 0 deletions ServerCTF/accounts/templates/profile/profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% extends 'navigationbar.html' %}

{% load static %}

{% block title %}
<title>Team Details</title>
{% endblock %}

{% block customcss %}
<link rel="stylesheet" type="text/css" href="{% static 'css/profile.css' %}">
{% endblock %}

{% block custombody %}

<div id="pageHeading">
<p>Profile</p>
</div>

<div class="container">
<div id="updateForm">
{% if request.method == 'POST' %}
{% if success %}
<div id="formSuccess">
<p>Details Updated</p>
</div>
{% else %}
<div id="formFailure">
<p>Some Error Occured</p>
</div>
{% endif %}
{% endif %}
<p><b>User Name</b> : {{ user.username }}</p>
<p><b>Email</b> : {{ user.email }}</p>
<form method="post">
{% csrf_token %}
{% for fields in form %}
<div>
<label>{{ fields.label }}</label>
{{ fields }}
</div>
{% endfor %}

<input type="submit" name="update" value="Update" class="updateFormButton">
</form>
</div>
<div style="text-align: center;">
<a href="changepassword/">Change Password</a>
</div>
</div>

{% endblock %}
45 changes: 45 additions & 0 deletions ServerCTF/accounts/templates/register/register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% extends 'navigationbar.html' %}

{% load static %}

{% block title %}
<title>Register</title>
{% endblock %}

{% block customcss %}
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% endblock %}

{% block custombody %}

<div id="pageHeading">
<p>Register</p>
</div>

<!-- Register here -->
<div id="register">
<div class="registerTop">
<table>
<tbody>
<tr>
<td style="border:0; border-bottom: 1px solid #888; color: #a3dc9c"><a href="../login"><span>LOGIN</span></a></td>
<td style="border-bottom: 0;"><a href=""><span>REGISTER</span></a></td>
</tr>
</tbody>
</table>
</div>
<div class="registerForm">
<form method="post">
{% csrf_token %}
{% for field in form %}
<div>
<label>{{ field.label }}</label>
{{ field }}
{{ field.errors }}
</div>
{% endfor %}
<button type="submit" name="submit" class="submitButton">Submit</button>
</form>
</div>
</div>
{% endblock %}
47 changes: 47 additions & 0 deletions ServerCTF/accounts/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% extends 'navigationbar.html' %}

<!-- {% load static %} -->

{% block title %}
<title>Login</title>
{% endblock %}

{% block customcss %}
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% endblock %}

{% block custombody %}

<div id="pageHeading">
<p>Login</p>
</div>

<div id="register">
<div class="registerTop">
<table>
<tbody>
<tr>
<td style="border-bottom: 0;"><a href=""><span>LOGIN</span></a></td>
<td style="border:0; border-bottom: 1px solid #888; color: #a3dc9c"><a href="../register"><span>REGISTER</span></a></td>
</tr>
</tbody>
</table>
</div>
<div class="registerForm">
<form method="post">
{% csrf_token %}

{% for field in form %}
<div>
<label>{{ field.label }}</label>
{{ field }}
{{ field.errors }}
</div>
{% endfor %}

<button type="submit" name="submit" class="submitButton">Login</button>
</form>
</div>
</div>

{% endblock %}
Loading