0.11.0 Google Auth
This commit is contained in:
@@ -36,6 +36,25 @@ WEBPUSH_SETTINGS = {
|
|||||||
"VAPID_ADMIN_EMAIL": "admin@tripwb.com"
|
"VAPID_ADMIN_EMAIL": "admin@tripwb.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = [
|
||||||
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
|
'allauth.account.auth_backends.AuthenticationBackend',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SOCIALACCOUNT_PROVIDERS = {
|
||||||
|
'google': {
|
||||||
|
'SCOPE': [
|
||||||
|
'profile',
|
||||||
|
'email',
|
||||||
|
],
|
||||||
|
'AUTH_PARAMS': {
|
||||||
|
'access_type': 'online',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# NOTIFICATION_KEY = 'BJLyGzmo8sLI3Qkc6pN2cz11frCXiJdewvgve7Yps-_fM1lY1LSnTQfQxYtAgQ_26nAji_rgeYC1DkLiTwxw0Mo'
|
# NOTIFICATION_KEY = 'BJLyGzmo8sLI3Qkc6pN2cz11frCXiJdewvgve7Yps-_fM1lY1LSnTQfQxYtAgQ_26nAji_rgeYC1DkLiTwxw0Mo'
|
||||||
|
|
||||||
# SESSION_COOKIE_HTTPONLY = False
|
# SESSION_COOKIE_HTTPONLY = False
|
||||||
@@ -63,6 +82,11 @@ INSTALLED_APPS = [
|
|||||||
|
|
||||||
'webpush',
|
'webpush',
|
||||||
|
|
||||||
|
'allauth',
|
||||||
|
'allauth.account',
|
||||||
|
'allauth.socialaccount',
|
||||||
|
'allauth.socialaccount.providers.google',
|
||||||
|
|
||||||
'GeneralApp',
|
'GeneralApp',
|
||||||
'AuthApp',
|
'AuthApp',
|
||||||
'RoutesApp',
|
'RoutesApp',
|
||||||
@@ -82,6 +106,8 @@ MIDDLEWARE = [
|
|||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'AuthApp.middleware.ResponseInterceptionMiddleware',
|
'AuthApp.middleware.ResponseInterceptionMiddleware',
|
||||||
|
|
||||||
|
"allauth.account.middleware.AccountMiddleware",
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'TWB.urls'
|
ROOT_URLCONF = 'TWB.urls'
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ urlpatterns = [
|
|||||||
path('ckeditor/', include('ckeditor_uploader.urls')),
|
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||||
path('i18n/', include('django.conf.urls.i18n')),
|
path('i18n/', include('django.conf.urls.i18n')),
|
||||||
|
|
||||||
# path('webpush/', include('webpush.urls')),
|
path('accounts/', include('allauth.urls')),
|
||||||
|
|
||||||
path('messages/', include('ChatServiceApp.urls')),
|
path('messages/', include('ChatServiceApp.urls')),
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ daphne==4.0.0
|
|||||||
channels-redis==4.1.0
|
channels-redis==4.1.0
|
||||||
django-colorfield
|
django-colorfield
|
||||||
django-webpush==0.3.5
|
django-webpush==0.3.5
|
||||||
|
django-allauth==0.60.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load socialaccount %}
|
||||||
|
|
||||||
{% trans "Логин" as p_login %}
|
{% trans "Логин" as p_login %}
|
||||||
{% trans "Пароль" as p_password %}
|
{% trans "Пароль" as p_password %}
|
||||||
|
|
||||||
<section class="login">
|
<section class="login">
|
||||||
<h1>{% translate "Войдите в профиль" %}</h1>
|
<h1>{% translate "Войдите в профиль" %}</h1>
|
||||||
|
|
||||||
<form class="login_form" name="login_form" method="post">
|
<form class="login_form" name="login_form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div>
|
<div>
|
||||||
{% if form.errors.all__ %}
|
{% if form.errors.all__ %}
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
<div class="agree_text_l">{% translate "Авторизуясь, вы соглашаетесь с Лицензионным соглашением Политикой конфиденциальности" %}</div>
|
<div class="agree_text_l">{% translate "Авторизуясь, вы соглашаетесь с Лицензионным соглашением Политикой конфиденциальности" %}</div>
|
||||||
<div id="reg_or_text">{% translate "Или" %}</div>
|
<div id="reg_or_text">{% translate "Или" %}</div>
|
||||||
|
|
||||||
<a href="{% url 'social:begin' 'google-oauth2' %}">
|
<a href="{% provider_login_url 'google' %}">
|
||||||
<div id = "google_text" class="google"><img src="/static/img/png/google.png" alt="">
|
<div id = "google_text" class="google"><img src="/static/img/png/google.png" alt="">
|
||||||
<div> {% translate "Войти через" %} Google</div>
|
<div> {% translate "Войти через" %} Google</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user