Skip to content

Commit

Permalink
Merge pull request EGCETSII#30 from Decide-Part-Penyagolosa-1/josgrarom
Browse files Browse the repository at this point in the history
Josgrarom
  • Loading branch information
pakote13rg authored Jan 5, 2022
2 parents 7b5cb80 + b9278f3 commit 81b700f
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 18 deletions.
1 change: 1 addition & 0 deletions decide/authentication/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@
</body>
<a class="fab fa-microsoft size_social text-info" aria-hidden="true" href="{% provider_login_url "microsoft" %}">microsoft</a>
<a class="fab fa-github size_social text-info" aria-hidden="true" href="{% provider_login_url "github" %}">GitHub</a>

41 changes: 41 additions & 0 deletions decide/booth/static/booth/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,44 @@
margin-top: 20px;
margin-left: 40px;
}

#customBtn {
display: inline-block;
background: white;
color: #444;
width: 190px;
border-radius: 5px;
border: thin solid #888;
box-shadow: 1px 1px 1px grey;
white-space: nowrap;
}

#main {
text-align: center;
}

#customBtn:hover {
cursor: pointer;
}

span.label {
font-family: serif;
font-weight: normal;
}

span.icon {
display: inline-block;
vertical-align: middle;
width: 20px;
height: 42px;
}

span.buttonText {
display: inline-block;
vertical-align: middle;
padding-left: 20px;
padding-right: 42px;
font-size: 14px;
font-weight: bold;
font-family: 'Roboto', sans-serif;
}
44 changes: 42 additions & 2 deletions decide/booth/templates/booth/booth.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{% extends "base.html" %}
{% load i18n static %}

{% load i18n static %}
{% load socialaccount %}
{% providers_media_js %}
{% block extrahead %}
<link type="text/css" rel="stylesheet"
href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet"
href="https://unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css" />
<link type="text/css" rel="stylesheet" href="{% static "booth/style.css" %}" />
{% endblock %}


{% block content %}
<div id="app-booth">
<!-- Navbar -->
Expand All @@ -23,7 +27,9 @@
<b-alert :variant="alertLvl" dismissible v-model="alertShow">
[[ alertMsg ]]
</b-alert>

{% if user.is_authenticated %}
<a href="{% url 'logoutG' %}">Logout</a>
{% endif %}
<div class="voting">
<h1>[[ voting.id ]] - [[ voting.name ]]</h1>

Expand All @@ -49,7 +55,38 @@ <h1>[[ voting.id ]] - [[ voting.name ]]</h1>
<b-button type="submit" variant="primary">{% trans "Login" %}</b-button>
</b-form>

<div id="main">
<span class="label">Inicia sesión con:</span>
</br>
</br>
<div id="customBtn" class="customGPlusSignIn">
<span class="icon"></span>
<a href="{% provider_login_url "google" %}">
<span class="buttonText">Google</span>
</a>
</div>
</br>
</br>
<div id="customBtn" class="customGPlusSignIn">
<span class="icon"></span>
<a href="{% provider_login_url "microsoft" %}">
<span class="buttonText">Microsoft</span>
</a>
</div>
</br>
</br>
<div id="customBtn" class="customGPlusSignIn">
<span class="icon"></span>
<a href="{% provider_login_url "github" %}">
<span class="buttonText">Github</span>
</a>
</div>
</div>



<!-- Voting -->

<div v-if="!signup">
<h2>[[ voting.question.desc ]]</h2>
<b-form-group v-for="opt in voting.question.options" :key="opt.number">
Expand All @@ -64,8 +101,10 @@ <h2>[[ voting.question.desc ]]</h2>
{% trans "Vote" %}
</b-button>
</div>

</div>
</div>

{% endblock %}

{% block extrabody %}
Expand Down Expand Up @@ -151,6 +190,7 @@ <h2>[[ voting.question.desc ]]</h2>
}
});
},

onSubmitLogin(evt) {
evt.preventDefault();
this.postData("{% url "gateway" "authentication" "/login/" %}", this.form)
Expand Down
33 changes: 17 additions & 16 deletions decide/decide/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand Down Expand Up @@ -57,7 +56,18 @@
]


IMPORT_EXPORT_USE_TRANSACTIONS = True
SOCIALACCOUNT_PROVIDERS = {
'google': {
'SCOPE': [
'profile',
'email',
],
'AUTH_PARAMS': {
'access_type': 'online',
}
}
}


REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
Expand All @@ -70,6 +80,7 @@
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'base.backends.AuthBackend',
'allauth.account.auth_backends.AuthenticationBackend'
]

MODULES = [
Expand Down Expand Up @@ -210,15 +221,13 @@
INSTALLED_APPS = INSTALLED_APPS + MODULES


AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend'
)

SITE_ID = 3


SITE_ID = 1

LOGIN_REDIRECT_URL = '/authentication/redirection'
LOGOUT_REDIRECT_URL = '/authentication/signin'
LOGOUT_REDIRECT_URL = '/booth/voting'


NOSE_ARGS = [
Expand All @@ -230,13 +239,5 @@
# django_heroku.settings(locals(),test_runner=False)


AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend'
)
SITE_ID = 3

LOGIN_REDIRECT_URL = '/'

import django_heroku
django_heroku.settings(locals(),test_runner=False)

0 comments on commit 81b700f

Please sign in to comment.