forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Villanueva-del-Trabuco-EGC/develop
Subiendo la funcionalidad estable a master
- Loading branch information
Showing
42 changed files
with
1,234 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from django.conf import settings | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth.backends import ModelBackend | ||
from django.db.models import Q | ||
|
||
|
||
class EmailOrUsernameModelBackend(ModelBackend): | ||
|
||
def authenticate(self, request, username=None, password=None, **kwargs): | ||
auth_type = settings.AUTH_AUTHENTICATION_TYPE | ||
if auth_type == 'username': | ||
return super().authenticate(username, password) | ||
user_model = get_user_model() | ||
try: | ||
if auth_type == 'both': | ||
user = user_model.objects.get( | ||
Q(username__iexact=username) | Q(email__iexact=username) | ||
) | ||
else: | ||
user = user_model.objects.get(email__iexact=username) | ||
if user.check_password(password): | ||
return user | ||
except user_model.DoesNotExist: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# decide auth translation | ||
# This file is distributed under the same license as the main project | ||
|
||
# Translators: Pablo Marin Gomez <[email protected]>, 2022 | ||
|
||
msgid "" | ||
msgstr "" | ||
|
||
"Language: es\n" | ||
"Last-Translator: Pablo Marin Gomez\n" | ||
"POT-Creation-Date: 2022-11-19 18:45+0100\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
53 changes: 53 additions & 0 deletions
53
decide/authentication/templates/authentication/register.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{% extends "base.html" %} | ||
{% load i18n static %} | ||
{% block content %} | ||
<div class="container"> | ||
<form method="POST"> | ||
{% csrf_token %} | ||
<div class="form-group"> | ||
<h1>Register</h1> | ||
<p>Please fill in this form to create an account.</p> | ||
<hr> | ||
<div class="form-row"> | ||
<div class="form-group col-md-6 mb-0"> | ||
<label for="first_name"><b>First Name</b></label> | ||
<input type="text" placeholder="Enter first name" name="first_name" id="first_name"> | ||
</div> | ||
<br> | ||
<div class="form-group col-md-6 mb-0"> | ||
<label for="last_name"><b>Last Name</b></label> | ||
<input type="text" placeholder="Enter last name" name="last_name" id="last_name"> | ||
</div> | ||
<br> | ||
</div> | ||
<div class="form-row"> | ||
<div class="form-group col-md-6 mb-0"> | ||
<label for="username"><b>Username</b></label> | ||
<input type="text" placeholder="Enter user name" name="username" id="username"> | ||
</div> | ||
<br> | ||
<div class="form-group col-md-6 mb-0"> | ||
<label for="email"><b>Email</b></label> | ||
<input type="text" placeholder="Enter Email" name="email" id="email"> | ||
</div> | ||
<br> | ||
</div> | ||
<div class="form-row"> | ||
<div class="form-group col-md-6 mb-0"> | ||
<label for="password"><b>Password</b></label> | ||
<input type="password" placeholder="Enter Password" name="password" id="password"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<p>By registering, you accept the <a href="#">Terms & Privacy</a>.</p> | ||
|
||
<div class="form-group"> | ||
<button class="registerbtn" type="submit">Register</button> | ||
</div> | ||
<div class="container signin"> | ||
<p>Already have an account? <a href="/">Sign In</a></p> | ||
</div> | ||
</form> | ||
</div> | ||
{% endblock content %} |
7 changes: 7 additions & 0 deletions
7
decide/authentication/templates/template_activate_account.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% autoescape off %} | ||
Hi {{ user.username }}, | ||
|
||
Please click on the link below to confirm your registration: | ||
|
||
{{protocol}}://{{domain}}{% url 'activate' uidb64=uid token=token %} | ||
{% endautoescape %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.contrib.auth.tokens import PasswordResetTokenGenerator | ||
import six | ||
|
||
class AccountActivateTokenGenerator(PasswordResetTokenGenerator): | ||
def _make_hash_value(self,user,timestamp): | ||
return ( | ||
six.text_type(user.pk) + | ||
six.text_type(timestamp) + | ||
six.text_type(user.is_active) | ||
) | ||
|
||
|
||
account_activation_token = AccountActivateTokenGenerator() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# decide base translation | ||
# This file is distributed under the same license as the main project | ||
|
||
# Translators: Pablo Marin Gomez <[email protected]>, 2022 | ||
|
||
msgid "" | ||
msgstr "" | ||
|
||
"Language: es\n" | ||
"Last-Translator: Pablo Marin Gomez\n" | ||
"POT-Creation-Date: 2022-11-19 18:00+0100\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# decide booth translation | ||
# This file is distributed under the same license as the main project | ||
|
||
# Translators: Pablo Marin Gomez <[email protected]>, 2022 | ||
|
||
msgid "" | ||
msgstr "" | ||
|
||
"Language: es\n" | ||
"Last-Translator: Pablo Marin Gomez\n" | ||
"POT-Creation-Date: 2022-11-19 16:00+0100\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
msgid "decide" | ||
msgstr "Decide" | ||
|
||
msgid "logout" | ||
msgstr "Salir" | ||
|
||
msgid "vID" | ||
msgstr "ID de la votación" | ||
|
||
msgid "vName" | ||
msgstr "Nombre de la votación" | ||
|
||
msgid "Login" | ||
msgstr "Identificarse" | ||
|
||
msgid "LoginGitHub" | ||
msgstr "Identificarse con GitHub" | ||
|
||
msgid "LoginFacebook" | ||
msgstr "Identificarse con Facebook" | ||
|
||
msgid "Vote" | ||
msgstr "Votar" | ||
|
||
msgid "Error" | ||
msgstr "Error" | ||
|
||
msgid "Conglatulations. Your vote has been sent" | ||
msgstr "¡Enhorabuena! Tu voto se ha enviado" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.