fixed bugs

This commit is contained in:
anon 2022-06-30 10:43:56 -03:00
parent 8a7df53aff
commit 461c76ffad
22 changed files with 728 additions and 268 deletions

View file

@ -35,8 +35,8 @@
<div class="col-xl-12 col-md-6 mb-4">
<div class="card border-left-new">
<div class="card-body">
<h5 class="card-title">Hi there</h5>
<p class="card-text">
<h5 class="card-title text-white">Hi there</h5>
<p class="card-text text-white">
You can call me Morpheus. I made this website to help fellow members of Monero's
community understand it, visualize adoption and to compare it against other
projects such as Bitcoin or its competitors

View file

@ -45,14 +45,25 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:articles' %}">Articles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:about' %}">About</a>
</li>
<li class="nav-item dropdown" >
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Languages
Hi, {{ user.username }}.
</a>
{% else %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Settings
</a>
{% endif %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url 'users:logout' %}">Logout</a>
{% else %}
<a class="nav-link" href="{% url 'users:login' %}">Login</a>
<a class="nav-link" href="{% url 'users:register' %}">Register</a>
{% endif %}
<a class="nav-link" href="{% url 'monerojnet:about' %}">About</a>
<div class="dropdown-divider"></div>
<a class="nav-link" href="{% url 'monerojnet:index' %}">English</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">French</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Portuguese</a>

View file

@ -30,14 +30,14 @@
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="{% url 'monerojnet:index' %}"><text class="color-orange">Gazeto</text> Monero<text class="color-orange">j</text> </a>
<a class="navbar-brand" href="{% url 'monerojnet:pt' %}"><text class="color-orange">Gazeto</text> Monero<text class="color-orange">j</text> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Inicial <span class="sr-only">(current)</span></a>
<a class="nav-link" href="{% url 'monerojnet:index' %}">Inicial <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:sfmodel' %}">Gráficos</a>
@ -45,14 +45,25 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:artigos' %}">Artigos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sobre</a>
</li>
<li class="nav-item dropdown" >
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Idiomas
Olá, {{ user.username }}.
</a>
{% else %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Configurações
</a>
{% endif %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url 'users:logout' %}">Sair</a>
{% else %}
<a class="nav-link" href="{% url 'users:login' %}">Entrar</a>
<a class="nav-link" href="{% url 'users:register' %}">Registrar</a>
{% endif %}
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sobre</a>
<div class="dropdown-divider"></div>
<a class="nav-link" href="{% url 'monerojnet:index' %}">Inglês</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">Francês</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Português</a>

View file

@ -28,11 +28,11 @@
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="{% url 'monerojnet:index' %}">Monero<text class="color-orange">j</text></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<a class="navbar-brand" href="{% url 'monerojnet:fr' %}">Monero<text class="color-orange">j</text></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
@ -46,14 +46,27 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:articles' %}">Articles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sur</a>
</li>
<li class="nav-item dropdown" >
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Langages
<li class="nav-item dropdown">
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Salut, {{ user.username }}.
</a>
{% else %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Réglages
</a>
{% endif %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url 'users:logout' %}">Sortir</a>
{% else %}
<a class="nav-link" href="{% url 'users:login' %}">Connexion</a>
<a class="nav-link" href="{% url 'users:register' %}">Enregistrement</a>
{% endif %}
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sur</a>
<div class="dropdown-divider"></div>
<a class="nav-link" href="{% url 'monerojnet:index' %}">Anglais</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">Français</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Portugaise</a>
@ -62,7 +75,7 @@
</ul>
</div>
</div>
</nav>
</nav>
<!-- ======= Hero Section ======= -->
<section id="hero" class="d-flex flex-column justify-content-center align-items-center">

View file

@ -1,67 +1,5 @@
<!DOCTYPE html>
<html lang="en">
{% load static %}
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Moneroj.net</title>
<meta content="" name="description">
<meta content="" name="keywords">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<link href="{% static 'img/favicon.png' %}" rel="icon">
<link href="{% static 'img/apple-touch-icon.png' %}" rel="apple-touch-icon">
<link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'vendor/boxicons/css/boxicons.min.css' %}" rel="stylesheet">
<style>
div.a {
word-break: break-all;
}
.color-orange {
color: #ff4d21;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="{% url 'monerojnet:index' %}">Monero<text class="color-orange">j</text></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="{% url 'monerojnet:index' %}">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:sfmodel' %}">Charts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:articles' %}">Articles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:about' %}">About</a>
</li>
<li class="nav-item dropdown" >
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Languages
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="nav-link" href="{% url 'monerojnet:index' %}">English</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">French</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Portuguese</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
{% extends "users/base.html" %}
{% block content %}
<!-- ======= Hero Section ======= -->
<section id="hero" class="d-flex flex-column justify-content-center align-items-center">
@ -419,63 +357,7 @@
</main>
<!-- End #main -->
<!-- ======= Footer ======= -->
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 footer-contact">
<h3>Moneroj.net</h3>
<p>
Developed by <br>
Morpheus<br>
<strong>Email:</strong> morpheus.anonymous@protonmail.com<br>
<strong>Twitter:</strong> CryptoMorpheus_<br>
<strong>Github:</strong> cryptomorpheuss<br>
</p>
</div>
<div class="col-lg-3 col-md-6 footer-links">
<h4>Useful Links</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:index' %}">Home</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:sfmodel' %}">Charts</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:about' %}">About</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="https://www.getmonero.org/">Getmonero.org</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="https://www.reddit.com/r/Monero/">Reddit/Monero</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container d-lg-flex py-4">
<div class="mr-lg-auto text-center text-lg-left">
<div class="copyright a">
<strong>&copy; Copyright <span>Moneroj.net</span></strong>
</div>
</div>
<div class="social-links text-center text-lg-right pt-3 pt-lg-0">
<a href="http://ilt7jgmfro76wgrtt6752lvfnhcz6wk5sjqhyvntjixygp3cwpvr4nad.onion" class="onion" alt="Tor Version"><i class="bx bx-hide"></i></a>
<a href="https://twitter.com/CryptoMorpheus_" class="twitter" alt="Twitter Profile"><i class="bx bxl-twitter"></i></a>
<a href="https://github.com/cryptomorpheuss/moneropro" class="github" alt="Github"><i class="bx bxl-github"></i></a>
<a href="mailto:morpheus.anonymous@protonmail.com" class="email" alt="Send E-mail"><i class="bx bx-mail-send"></i></a>
</div>
</div>
</footer>
<!-- End Footer -->
<!-- Vendor JS Files -->
<script src="{% static 'vendor/jquery/jquery2.min.js' %}"></script>
<script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
</body>
</html>
{% endblock content %}

View file

@ -30,7 +30,7 @@
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="{% url 'monerojnet:index' %}">Monero<text class="color-orange">j</text></a>
<a class="navbar-brand" href="{% url 'monerojnet:pt' %}">Monero<text class="color-orange">j</text></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@ -45,14 +45,25 @@
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:artigos' %}">Artigos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sobre</a>
</li>
<li class="nav-item dropdown" >
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Idiomas
Olá, {{ user.username }}.
</a>
{% else %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Configurações
</a>
{% endif %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url 'users:logout' %}">Sair</a>
{% else %}
<a class="nav-link" href="{% url 'users:login' %}">Entrar</a>
<a class="nav-link" href="{% url 'users:register' %}">Registrar</a>
{% endif %}
<a class="nav-link" href="{% url 'monerojnet:about' %}">Sobre</a>
<div class="dropdown-divider"></div>
<a class="nav-link" href="{% url 'monerojnet:index' %}">Inglês</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">Francês</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Português</a>

View file

@ -1056,6 +1056,10 @@ def update_database(date_from=None, date_to=None):
data.zcash_marketcap = 0
# Transactions charts
data.xmr_transacpercentage = 0
data.btc_transactions = 0
data.zcash_transactions = 0
data.dash_transactions = 0
data.grin_transactions = 0
data.xmr_transactions = 0
data.btc_supply = 0
data.xmr_supply = 0
@ -1107,7 +1111,6 @@ def update_database(date_from=None, date_to=None):
data.crypto_commentsPerHour = 0
data.crypto_postsPerHour = 0
try:
# Date field
data.date = coin_xmr.date
# Basic information
@ -1127,6 +1130,9 @@ def update_database(date_from=None, date_to=None):
pass
data.xmr_transactions = coin_xmr.transactions
data.btc_transactions = coin_btc.transactions
data.zcash_transactions = coin_zcash.transactions
data.dash_transactions = coin_dash.transactions
data.grin_transactions = coin_grin.transactions
data.btc_supply = coin_btc.supply
data.xmr_supply = coin_xmr.supply
# Issuance charts
@ -1194,9 +1200,6 @@ def update_database(date_from=None, date_to=None):
data.save()
print(str(coin_xmr.date) + ' - ' + str(int(coin_xmr.supply)) + ' xmr @ ' + str(coin_xmr.priceusd) + ' = ' + str(int(data.xmr_marketcap)))
except:
return count
count += 1
return count

View file

@ -48,6 +48,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'monerojnet',
'users',
]
MIDDLEWARE = [

View file

@ -21,4 +21,5 @@ app_name = 'monerojnet'
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', include(('monerojnet.urls', 'monerojnet'), namespace='monerojnet')),
url(r'', include(('users.urls', 'users'), namespace='users')),
]

0
users/__init__.py Normal file
View file

3
users/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
users/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'

11
users/forms.py Normal file
View file

@ -0,0 +1,11 @@
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class SignUpForm(UserCreationForm):
email = forms.EmailField(max_length=150, help_text='E-mail')
type = forms.CharField(max_length=100, help_text='Contributor or user?')
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2', 'type')

24
users/models.py Normal file
View file

@ -0,0 +1,24 @@
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
email = models.EmailField(max_length=150)
type = models.CharField(max_length=100, blank=True)
def __str__(self):
return self.user.username
class BlockedEmail(models.Model):
email = models.EmailField(max_length=150)
def __str__(self):
return self.id
@receiver(post_save, sender=User)
def update_profile_signal(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
instance.profile.save()

View file

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
{% load static %}
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Moneroj.net</title>
<meta content="" name="description">
<meta content="" name="keywords">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<link href="{% static 'img/favicon.png' %}" rel="icon">
<link href="{% static 'img/apple-touch-icon.png' %}" rel="apple-touch-icon">
<link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'vendor/boxicons/css/boxicons.min.css' %}" rel="stylesheet">
<style>
div.a {
word-break: break-all;
}
.color-orange {
color: #ff4d21;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="{% url 'monerojnet:index' %}">Monero<text class="color-orange">j</text></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="{% url 'monerojnet:index' %}">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:sfmodel' %}">Charts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'monerojnet:articles' %}">Articles</a>
</li>
<li class="nav-item dropdown" >
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Hi, {{ user.username }}.
</a>
{% else %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Settings
</a>
{% endif %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url 'users:logout' %}">Logout</a>
{% else %}
<a class="nav-link" href="{% url 'users:login' %}">Login</a>
<a class="nav-link" href="{% url 'users:register' %}">Register</a>
{% endif %}
<a class="nav-link" href="{% url 'monerojnet:about' %}">About</a>
<div class="dropdown-divider"></div>
<a class="nav-link" href="{% url 'monerojnet:index' %}">English</a>
<a class="nav-link" href="{% url 'monerojnet:fr' %}">French</a>
<a class="nav-link" href="{% url 'monerojnet:pt' %}">Portuguese</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
{% block header %}{% endblock header %}
{% block content %}{% endblock content %}
<!-- ======= Footer ======= -->
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 footer-contact">
<h3>Moneroj.net</h3>
<p>
Developed by <br>
Morpheus<br>
<strong>Email:</strong> morpheus.anonymous@protonmail.com<br>
<strong>Twitter:</strong> CryptoMorpheus_<br>
<strong>Github:</strong> cryptomorpheuss<br>
</p>
</div>
<div class="col-lg-3 col-md-6 footer-links">
<h4>Useful Links</h4>
<ul>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:index' %}">Home</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:sfmodel' %}">Charts</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="{% url 'monerojnet:about' %}">About</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="https://www.getmonero.org/">Getmonero.org</a></li>
<li><i class="bx bx-chevron-right"></i> <a href="https://www.reddit.com/r/Monero/">Reddit/Monero</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container d-lg-flex py-4">
<div class="mr-lg-auto text-center text-lg-left">
<div class="copyright a">
<strong>&copy; Copyright <span>Moneroj.net</span></strong>
</div>
</div>
<div class="social-links text-center text-lg-right pt-3 pt-lg-0">
<a href="http://ilt7jgmfro76wgrtt6752lvfnhcz6wk5sjqhyvntjixygp3cwpvr4nad.onion" class="onion" alt="Tor Version"><i class="bx bx-hide"></i></a>
<a href="https://twitter.com/CryptoMorpheus_" class="twitter" alt="Twitter Profile"><i class="bx bxl-twitter"></i></a>
<a href="https://github.com/cryptomorpheuss/moneropro" class="github" alt="Github"><i class="bx bxl-github"></i></a>
<a href="mailto:morpheus.anonymous@protonmail.com" class="email" alt="Send E-mail"><i class="bx bx-mail-send"></i></a>
</div>
</div>
</footer>
<!-- End Footer -->
{% load static %}
<!-- Vendor JS Files -->
<script src="{% static 'vendor/jquery/jquery2.min.js' %}"></script>
<script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
</body>
</html>

View file

@ -0,0 +1,32 @@
{% extends "users/base.html" %}
{% block content %}
<br>
<div class="container">
<center><h3>Rules of conduct</h3></center><br>
<p align="justify">
<b>1:</b> Moneroj.net does not store the IP or any other personal data about its users. The only data stored are e-mail (which the user doesn't even need to confirm, so he can fake an account), username and password. If the user provides a fake e-mail he might be subject of losing access to his account in case he loses his password.
<br><br>
<b>2:</b> If Moneroj.net ever provide services as an exchange, transactions will be stored on the server, but will be available for erase by the user. If we ever provide services as a marketplace, only data stored will be the ones provided as free will by the user, such as item price, item name, wallet address (in case of the seller), etc. The user will be able to erase any personal data he wishes.
<br><br>
<b>3:</b> If the user writes articles for the news service, these will be inspected by the administration team (or other contributors) before release. Any article that doesn't reflect Moneroj's ethics will be erased without further notice. Some articles may go to review, and those approved will be published.
<br><br>
<b>4:</b> The user is the owner the articles he wrote, but he grants permission for Moneroj and any other party to distribute the article, as long as these websites acknowledge the creator of that article. Any article published on Moneroj.net must have a license Creative Commons (<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a>). If the user wishes to publish the same article on more than one website, he is free to do so, there's no exclusivity.
<br><br>
</p>
<div>
<center>
<a class="button btn btn-success" href="{% url 'monerojnet:index' %}">Accept</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a class="button btn btn-danger" href="{% url 'users:delete_user' user.profile.id %}">Reject</a>
</center>
</div>
</div>
<br><br>
{% endblock content %}

View file

@ -0,0 +1,113 @@
{% extends "users/base.html" %}
{% block header %}
<style>
.login_page {
width: 360px;
padding: 10% 0 0;
margin: auto
}
.form {
position: relative;
z-index: 1;
background: #313030;
max-width: 360px;
margin: 0 auto 100px;
padding: 45px;
text-align: center;
border-radius: 20px
}
.form input {
font-family: "Roboto", Sans-serif;
outline: 0;
width: 100%;
border: 0;
margin: 0 0 15px;
padding: 15px;
font-size: 14px;
border-radius: 5px
}
.form button {
font-family: "Roboto", Sans-serif;
outline: 0;
background: #ff4d21;
width: 100%;
border: 0;
border-radius: 5px;
padding: 15px;
color: #ffffff;
font-size: 14px;
cursor: pointer
}
.form button:hover,
.form button:active {
background: #db3b13
}
.form .message {
margin: 15px 0 0;
color: rgb(255, 255, 255);
font-size: 16px
}
.form .message a {
color: #ff4d21;
text-decoration: none
}
.form .register_form {
display: none
}
</style>
{% endblock header %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xl-6 d-flex flex-column justify-content-center">
<center>
<h1>Already have an account?</h1>
<h3>Login to write articles and contribute.</h3>
</center>
</div>
<div class="col-xl-6 d-flex flex-column justify-content-center">
<form action="{% url 'users:login' %}" method='POST'>
{% csrf_token %}
<div class="col-md-12">
<div class="col-md-12">
<div class="login_page">
{% if form.errors %}
<div class="alert alert-danger">
<strong><center>Username or password incorrect.</center></strong>
</div>
{% endif %}
<div class="form">
<h1><i class="bx bx-user text-white"></i></h1>
<p class="message">Login:</p><br>
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<button>Enter</button>
<p class="message">Not registered?<a href="{% url 'users:register' %}"> Register now!</a></p>
<input type="hidden" name="next" value="{% url 'monerojnet:index' %}">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock content %}

View file

@ -0,0 +1,113 @@
{% extends "users/base.html" %}
{% block header %}
<style>
.login_page {
width: 360px;
padding: 10% 0 0;
margin: auto
}
.form {
position: relative;
z-index: 1;
background: #313030;
max-width: 360px;
margin: 0 auto 100px;
padding: 45px;
text-align: center;
border-radius: 20px
}
.form input {
font-family: "Roboto", Sans-serif;
outline: 0;
width: 100%;
border: 0;
margin: 0 0 15px;
padding: 15px;
font-size: 14px;
border-radius: 5px
}
.form button {
font-family: "Roboto", Sans-serif;
outline: 0;
background: #ff4d21;
width: 100%;
border: 0;
border-radius: 5px;
padding: 15px;
color: #ffffff;
font-size: 14px;
cursor: pointer
}
.form button:hover,
.form button:active {
background: #db3b13
}
.form .message {
margin: 15px 0 0;
color: rgb(255, 255, 255);
font-size: 16px
}
.form .message a {
color: #ff4d21;
text-decoration: none
}
.form .register_form {
display: none
}
</style>
{% endblock header %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xl-6 d-flex flex-column justify-content-center">
<center>
<h1>Don't have an account?</h1>
<h3>Register to become a contributor. No personal data needed.</h3>
</center>
</div>
<div class="col-xl-6 d-flex flex-column justify-content-center">
<form action="{% url 'users:register' %}" method='POST'>
{% csrf_token %}
<div class="col-md-12">
<div class="login_page">
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
<div class="alert alert-danger">
<strong><center>{{ error|escape }}</center></strong>
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div class="form">
<h1><i class="bx bx-user-plus text-white"></i></h1>
<p class="message">Register a new user:</p><br>
<input type="text" name="username" placeholder="Username">
<input type="hidden" name="type" value="user">
<input type="text" name="email" placeholder="Your e-mail">
<input type="password" name="password1" placeholder="Password">
<input type="password" name="password2" placeholder="Repeat the password">
<button>Register</button>
<p class="message">Already registered? <a href="{% url 'users:login' %}">Login</a></p>
<input type="hidden" name="next" value="{% url 'monerojnet:index' %}">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock content %}

3
users/tests.py Normal file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

20
users/urls.py Normal file
View file

@ -0,0 +1,20 @@
from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
#login page
path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
#logou page
path('logout/', views.logout_view, name="logout"),
#new user register
path('register/', views.register, name="register"),
#contract page
path('contract/', views.contract, name="contract"),
#contract page
path('delete_user/<str:identification>/', views.delete_user, name="delete_user")
]

59
users/views.py Normal file
View file

@ -0,0 +1,59 @@
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from .models import *
from .forms import *
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required
# Create your views here.
def logout_view(request):
logout(request)
return HttpResponseRedirect(reverse('monerojnet:index'))
def register(request):
user = request.user
if user.is_authenticated:
return HttpResponseRedirect(reverse('monerojnet:index'))
if request.method != 'POST':
form = SignUpForm()
else:
form = SignUpForm(data=request.POST)
if form.is_valid():
user = form.save()
user.refresh_from_db()
user.profile.email = form.cleaned_data.get('email')
user.profile.type = form.cleaned_data.get('type')
user.save()
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password1')
user = authenticate(username=username, password=password)
login(request, user)
return HttpResponseRedirect(reverse('users:contract'))
else:
context = {'form': form}
return render(request, 'users/register.html', context)
context = {'form': form}
return render(request, 'users/register.html', context)
@login_required
def contract(request):
context = {}
return render(request, "users/contract.html", context)
@login_required
def delete_user(request, identification):
profile = Profile.objects.get(id=identification)
user = User.objects.get(username=profile.user)
user_aux = request.user
if request.user.username != "Administrador" and user != user_aux:
return render(request, 'monerojnet/index.html')
profile = Profile.objects.get(id=identification)
user = User.objects.get(username=profile.user)
profile.delete()
user.delete()
return HttpResponseRedirect(reverse('monerojnet:index'))