Skip to content

Commit

Permalink
Improving code: following DRY practices
Browse files Browse the repository at this point in the history
  • Loading branch information
princekhunt committed Jul 9, 2024
1 parent a317bd8 commit 1fb67a6
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 214 deletions.
37 changes: 6 additions & 31 deletions registration/templates/registration/AnonymousDirectLogin.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
{%load static%}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="PrivatePing - Anonymous Direct Login" />
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />
{% extends "registration/Base.html" %}
{% load static %}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/registration/AnonymousDirectLogin.css' %}" />

<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}" />
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}" />
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}" />

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'images/favicons/android-chrome-192x192.png' %}" />
<link rel="icon" type="image/png" sizes="512x512" href="{% static 'images/favicons/android-chrome-512x512.png' %}" />

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />

<title>PrivatePing - Anonymous Direct Login</title>
{% block content %}
<link rel="stylesheet" href="{% static 'css/registration/AnonymousDirectLogin.css' %}" />
<title>PrivatePing - Anonymous Direct Login</title>
</head>

<body>

<form id="anonymous-direct-login-form">
{% csrf_token %}
<div id="login-container">
Expand All @@ -39,11 +17,8 @@ <h1 style="text-align: center" id="processing">Checking Browser...</h1>
{{ form.hcaptcha }}
</div>
<input name="action" type="hidden" value="create" />

</div>
</form>

<script type="text/javascript" src="{% static 'js/registration/AnonymousDirectLogin.js' %}"></script>
<script src="{% static 'js/Base.js' %}"></script>
</body>
</html>
{% endblock %}
41 changes: 41 additions & 0 deletions registration/templates/registration/Base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="PrivatePing - Anonymous Direct Login" />
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}" />
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}" />
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}" />

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192"
href="{% static 'images/favicons/android-chrome-192x192.png' %}" />
<link rel="icon" type="image/png" sizes="512x512"
href="{% static 'images/favicons/android-chrome-512x512.png' %}" />

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />

{% block content %}{% endblock %}


<script src="{% static 'js/Base.js' %}"></script>

</body>

</html>
38 changes: 6 additions & 32 deletions registration/templates/registration/GenerateKeys.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,18 @@
{% extends "registration/Base.html" %}
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="PrivatePing - Generate Keys">
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/registration/GenerateKeys.css' %}">

<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}">

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'images/favicons/android-chrome-192x192.png' %}">
<link rel="icon" type="image/png" sizes="512x512" href="{% static 'images/favicons/android-chrome-512x512.png' %}">

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">

<title>PrivatePing - Securing Session</title>

{% block content %}
<link rel="stylesheet" href="{% static 'css/registration/GenerateKeys.css' %}">
<title>PrivatePing - Securing Session</title>
</head>

<body>

<div id="login-container">
<div id="login-form">
<span class="loader"></span>
<h1 id="processing">Generating Secure Keypair...</h1>
</div>
</div>
<script type="text/javascript" src="{% static 'js/registration/GenerateKeys.js' %}"></script>
<script src="{% static 'js/Base.js' %}"></script>

</body>

</html>
{% endblock %}
41 changes: 9 additions & 32 deletions registration/templates/registration/Home.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
{% extends "registration/Base.html" %}
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description"
content="PrivatePing - Discover unparalleled privacy with our secure web messaging app. Enjoy end-to-end encryption, automatic message deletion on refresh, key rotation with each login, and anonymous login options. Chat securely and anonymously with peace of mind." />
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />
{% block content %}

<link rel="stylesheet" href="{% static 'css/registration/registration_home.css' %}" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/registration/registration_home.css' %}" />

<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}" />
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}" />
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}" />

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'images/favicons/android-chrome-192x192.png' %}" />
<link rel="icon" type="image/png" sizes="512x512" href="{% static 'images/favicons/android-chrome-512x512.png' %}" />

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />

<title>PrivatePing: A secure messaging Application</title>
<title>PrivatePing: A secure messaging Application</title>
</head>

<body>
Expand All @@ -49,9 +28,10 @@
<h5 style="text-align: center" id="credits">An open source project, Initiated by

<a target="_blank" href="https://linkedin.com/in/princekhunt">Prince Khunt</a> &
<a target="_blank" href="https://www.linkedin.com/in/viraj-bhingradiya-720b39216">Viraj Bhingradiya</a>. Checkout project on <a target="_blank"

href="https://github.com/princekhunt/privateping">Github</a>.
<a target="_blank" href="https://www.linkedin.com/in/viraj-bhingradiya-720b39216">Viraj Bhingradiya</a>. Give a
⭐️ on <a target="_blank" href="https://github.com/princekhunt/privateping">Github</a>.
<br>Checkout
<a target="_blank" href="https://privateping.bytespot.tech/humans.txt">Contributors!</a>
</h5>
</div>
</div>
Expand All @@ -70,7 +50,4 @@ <h5 style="text-align: center" id="credits">An open source project, Initiated by
"{% url 'registration:anonymous_direct_login' %}";
}
</script>
<script src="{% static 'js/Base.js' %}"></script>
</body>

</html>
{% endblock %}
53 changes: 8 additions & 45 deletions registration/templates/registration/Login.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
{% extends "registration/Base.html" %}
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description"
content="PrivatePing - Secure your conversations with our encrypted messaging platform. Experience peace of mind with end-to-end encryption, automatic message deletion, key rotation, and anonymous login options. Protect your privacy while staying connected securely.">
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{% static 'css/registration/Login.css' %}">

<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}">

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'images/favicons/android-chrome-192x192.png' %}">
<link rel="icon" type="image/png" sizes="512x512" href="{% static 'images/favicons/android-chrome-512x512.png' %}">

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
<title>PrivatePing - Login</title>
<style>

</style>
{% block content %}
<link rel="stylesheet" href="{% static 'css/registration/Login.css' %}">
<title>PrivatePing - Login</title>
</head>

<body>

<span id="pageloader" class="pageloader"></span>

<div id="Maincontent">

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 1600 900" preserveAspectRatio="xMidYMax slice">
<defs>
Expand Down Expand Up @@ -76,8 +43,7 @@
<div style="position: relative;" id="login-container">
<h1 style="color: antiquewhite;">PrivatePing - Login</h1>
<div id="login-form">
<img src="{% static 'images/user/login.gif' %}" alt="Loading" id="loading-gif" height="40%"
width="40%">
<img src="{% static 'images/user/login.gif' %}" alt="Loading" id="loading-gif" height="40%" width="40%">
<h1 style="color: antiquewhite;" id="processing"></h1>
<form id="LoginForm" method="post">{% csrf_token %}
<div id="username-form">
Expand Down Expand Up @@ -105,13 +71,10 @@ <h1 style="color: antiquewhite;" id="processing"></h1>
<p style="color:cornsilk; margin-top: 2rem;">Do you know?</p>
<small style="color: #ccc;">{{fact}}</small>
<div>
<button class="btn-lg btn-primary back-btn" onclick="goback();"><i class="fa fa-arrow-left" aria-hidden="true"></i></button>
<button class="btn-lg btn-primary back-btn" onclick="goback();"><i class="fa fa-arrow-left"
aria-hidden="true"></i></button>
</div>
</div>
</div>
<script type="text/javascript" src="{% static 'js/registration/Login.js' %}"></script>
<script src="{% static 'js/Base.js' %}"></script>

</body>

</html>
{% endblock %}
48 changes: 7 additions & 41 deletions registration/templates/registration/Signup.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,14 @@
{% extends "registration/Base.html" %}
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description"
content="PrivatePing - Begin your secure journey with us by signing up for our encrypted messaging platform. Safeguard your privacy with our end-to-end encryption, ensuring your data remains confidential. Experience seamless registration and enjoy the peace of mind that comes with secure communication. Join now and connect with confidence.">
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' {{domain}}">
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="{% static 'fonts/fonts.min.css' %}" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="{% static 'css/registration/Signup.css' %}">

<!--define favicon for all devices-->
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'images/favicons/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'images/favicons/favicon-16x16.png' %}">

<!--define favicon for android chrome-->
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'images/favicons/android-chrome-192x192.png' %}">
<link rel="icon" type="image/png" sizes="512x512" href="{% static 'images/favicons/android-chrome-512x512.png' %}">

<!--define favicon general-->
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
<title>PrivatePing - Signup</title>
{% block content %}
<link rel="stylesheet" type="text/css" href="{% static 'css/registration/Signup.css' %}">
<title>PrivatePing - Signup</title>
</head>

<body>

<span id="pageloader" class="pageloader"></span>

<div id="Maincontent">

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100%" height="100%" viewBox="0 0 1600 900" preserveAspectRatio="xMidYMax slice">
<defs>
Expand Down Expand Up @@ -125,14 +95,10 @@ <h1 style="color: antiquewhite;" id="processing"></h1>
<p style="color:cornsilk; margin-top: 2rem;">Do you know?</p>
<small style="color: #ccc;">{{fact}}</small>
<div>
<button class="btn-lg btn-primary back-btn" onclick="goback();"><i class="fa fa-arrow-left" aria-hidden="true"></i></button>
<button class="btn-lg btn-primary back-btn" onclick="goback();"><i class="fa fa-arrow-left"
aria-hidden="true"></i></button>
</div>
</div>

<script src="{% static 'js/registration/Signup.js' %}"></script>
<script src="{% static 'js/Base.js' %}"></script>


</body>

</html>
{% endblock %}
Loading

0 comments on commit 1fb67a6

Please sign in to comment.