Facebook auth return user email; fixed URL in templates

This commit is contained in:
Anatoly 2019-09-18 11:21:06 +03:00
parent 2908286e6c
commit 784728d155
6 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,5 @@
"""Serializers for account web""" """Serializers for account web"""
from django.contrib.auth import password_validation as password_validators from django.contrib.auth import password_validation as password_validators
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers from rest_framework import serializers
from account import models from account import models
@ -25,7 +24,7 @@ class PasswordResetSerializer(serializers.Serializer):
if not user.is_authenticated: if not user.is_authenticated:
if not username_or_email: if not username_or_email:
raise serializers.ValidationError(_('username or email not in request body.')) raise utils_exceptions.UserNotFoundError()
filters = {} filters = {}
if username_validator(username_or_email): if username_validator(username_or_email):

View File

@ -116,7 +116,7 @@ class OAuth2SignUpView(OAuth2ViewMixin, JWTGenericViewMixin):
source = serializer.validated_data.get('source') source = serializer.validated_data.get('source')
request_data.update({ request_data.update({
'grant_type': settings.OAUTH2_SOCIAL_AUTH_GRANT_TYPE, 'grant_type': settings.OAUTH2_SOCIAL_AUTH_GRANT_TYPE,
'backend': settings.OAUTH2_SOCIAL_AUTH_BACKEND_NAME 'backend': settings.OAUTH2_SOCIAL_AUTH_BACKEND_NAME,
}) })
# Use the rest framework `.data` to fake the post body of the django request. # Use the rest framework `.data` to fake the post body of the django request.

View File

@ -256,6 +256,10 @@ OAUTH2_PROVIDER_APPLICATION_MODEL = 'authorization.Application'
# Facebook configuration # Facebook configuration
SOCIAL_AUTH_FACEBOOK_KEY = '386843648701452' SOCIAL_AUTH_FACEBOOK_KEY = '386843648701452'
SOCIAL_AUTH_FACEBOOK_SECRET = 'a71cf0bf3980843a8f1ea74c6d805fd7' SOCIAL_AUTH_FACEBOOK_SECRET = 'a71cf0bf3980843a8f1ea74c6d805fd7'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', ]
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
'fields': 'id, name, email',
}
# SMS Settings # SMS Settings
SMS_EXPIRATION = 5 SMS_EXPIRATION = 5

View File

@ -3,7 +3,7 @@
{% trans "Please go to the following page for confirmation new email address:" %} {% trans "Please go to the following page for confirmation new email address:" %}
<a href="https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/">https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/</a> https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/
{% trans "Thanks for using our site!" %} {% trans "Thanks for using our site!" %}

View File

@ -3,7 +3,7 @@
{% trans "Please go to the following page and choose a new password:" %} {% trans "Please go to the following page and choose a new password:" %}
<a href="https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/">https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/</a> https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/
{% trans "Thanks for using our site!" %} {% trans "Thanks for using our site!" %}

View File

@ -2,8 +2,7 @@
{% blocktrans %}You're receiving this email because you trying to register new account at {{ site_name }}.{% endblocktrans %} {% blocktrans %}You're receiving this email because you trying to register new account at {{ site_name }}.{% endblocktrans %}
{% trans "Please confirm your email address to complete the registration:" %} {% trans "Please confirm your email address to complete the registration:" %}
https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/
<a href="https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/">https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/</a>
{% trans "Thanks for using our site!" %} {% trans "Thanks for using our site!" %}