team
This commit is contained in:
parent
b421b934c1
commit
8e22119de9
|
|
@ -388,6 +388,7 @@ class User(PhoneModelMixin, AbstractUser):
|
||||||
'twitter_page_url': socials.twitter_page_url if socials else '#',
|
'twitter_page_url': socials.twitter_page_url if socials else '#',
|
||||||
'instagram_page_url': socials.instagram_page_url if socials else '#',
|
'instagram_page_url': socials.instagram_page_url if socials else '#',
|
||||||
'facebook_page_url': socials.facebook_page_url if socials else '#',
|
'facebook_page_url': socials.facebook_page_url if socials else '#',
|
||||||
|
'contact_email': socials.contact_email if socials else '-',
|
||||||
'send_to': username,
|
'send_to': username,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ urlpatterns_api = [
|
||||||
path('reset-password/', views.PasswordResetView.as_view(), name='password-reset'),
|
path('reset-password/', views.PasswordResetView.as_view(), name='password-reset'),
|
||||||
path('reset-password/confirm/<uidb64>/<token>/', views.PasswordResetConfirmView.as_view(),
|
path('reset-password/confirm/<uidb64>/<token>/', views.PasswordResetConfirmView.as_view(),
|
||||||
name='password-reset-confirm'),
|
name='password-reset-confirm'),
|
||||||
|
path('join-establishment-team/<uidb64>/<token>/<int:role_id>', views.ApplyUserEstablishmentRole.as_view(),
|
||||||
|
name='join-establishment-team'),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns = urlpatterns_api + \
|
urlpatterns = urlpatterns_api + \
|
||||||
|
|
|
||||||
|
|
@ -72,3 +72,40 @@ class PasswordResetConfirmView(JWTGenericViewMixin, generics.GenericAPIView):
|
||||||
access_token=tokens.get('access_token'),
|
access_token=tokens.get('access_token'),
|
||||||
refresh_token=tokens.get('refresh_token')),
|
refresh_token=tokens.get('refresh_token')),
|
||||||
response=Response(status=status.HTTP_200_OK))
|
response=Response(status=status.HTTP_200_OK))
|
||||||
|
|
||||||
|
|
||||||
|
class ApplyUserEstablishmentRole(JWTGenericViewMixin, generics.GenericAPIView):
|
||||||
|
|
||||||
|
queryset = models.User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
"""Overridden get_object method"""
|
||||||
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
|
uidb64 = self.kwargs.get('uidb64')
|
||||||
|
|
||||||
|
user_id = force_text(urlsafe_base64_decode(uidb64))
|
||||||
|
token = self.kwargs.get('token')
|
||||||
|
|
||||||
|
user = get_object_or_404(queryset, id=user_id)
|
||||||
|
|
||||||
|
if not GMTokenGenerator(GMTokenGenerator.RESET_PASSWORD).check_token(
|
||||||
|
user, token):
|
||||||
|
raise utils_exceptions.NotValidTokenError()
|
||||||
|
|
||||||
|
# May raise a permission denied
|
||||||
|
self.check_object_permissions(self.request, user)
|
||||||
|
|
||||||
|
return get_object_or_404(klass=models.UserRole, pk=self.kwargs['role_id'], user=user), user
|
||||||
|
|
||||||
|
def patch(self, request, *args, **kwargs):
|
||||||
|
instance, user = self.get_object()
|
||||||
|
instance.state = models.UserRole.VALIDATED
|
||||||
|
instance.save()
|
||||||
|
# Create tokens
|
||||||
|
tokens = user.create_jwt_tokens()
|
||||||
|
return self._put_cookies_in_response(
|
||||||
|
cookies=self._put_data_in_cookies(
|
||||||
|
access_token=tokens.get('access_token'),
|
||||||
|
refresh_token=tokens.get('refresh_token')),
|
||||||
|
response=Response(status=status.HTTP_200_OK))
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="letter__text" style="margin: 0 0 30px; font-family:"Open-Sans",sans-serif; font-size: 14px; line-height: 21px;letter-spacing: -0.34px; overflow-x: hidden;">
|
<div class="letter__text" style="margin: 0 0 30px; font-family:"Open-Sans",sans-serif; font-size: 14px; line-height: 21px;letter-spacing: -0.34px; overflow-x: hidden;">
|
||||||
<br>
|
<br>
|
||||||
{% blocktrans %}Hi, you are receiving this email because you have been granted to manage the establishment <b>%restaurant_name%</b>.
|
{% blocktrans %}Hi, you are receiving this email because you have been granted to manage the establishment <b>{{ restaurant_name }}</b>.
|
||||||
From now, you can manage information about this place and have it published in {{ site_name }}.{% endblocktrans %}
|
From now, you can manage information about this place and have it published in {{ site_name }}.{% endblocktrans %}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
@ -66,7 +66,7 @@ From now, you can manage information about this place and have it published in {
|
||||||
<div class="letter__unsubscribe" style="margin: 0 0 1.25rem;font-size: 12px;text-align: center;">
|
<div class="letter__unsubscribe" style="margin: 0 0 1.25rem;font-size: 12px;text-align: center;">
|
||||||
<span class="letter__unsubscribe-dscr" style="display: inline-block;"> In case that you were not already a Gault&Millau user, a temporary account with your email has been temporarily created by a Gault&Millau administrator.
|
<span class="letter__unsubscribe-dscr" style="display: inline-block;"> In case that you were not already a Gault&Millau user, a temporary account with your email has been temporarily created by a Gault&Millau administrator.
|
||||||
By completing the creation process of your account, you agree to have this account permanently created.
|
By completing the creation process of your account, you agree to have this account permanently created.
|
||||||
This temporary account will be deleted after 7 days if you don't complete the registration process. Please contact %license_contact_email% if you have any questions.</span>
|
This temporary account will be deleted after 7 days if you don't complete the registration process. Please contact {{ contact_email }} if you have any questions.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="letter__footer" style="padding: 24px 0 15px;text-align: center;background: #ffee29;">
|
<div class="letter__footer" style="padding: 24px 0 15px;text-align: center;background: #ffee29;">
|
||||||
<div class="letter__footer-logo" style="width: 71px;height: 42px;margin: 0 auto 14px auto;">
|
<div class="letter__footer-logo" style="width: 71px;height: 42px;margin: 0 auto 14px auto;">
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ From now, you can manage information about this place and have it published in {
|
||||||
<div class="letter__unsubscribe" style="margin: 0 0 1.25rem;font-size: 12px;text-align: center;">
|
<div class="letter__unsubscribe" style="margin: 0 0 1.25rem;font-size: 12px;text-align: center;">
|
||||||
<span class="letter__unsubscribe-dscr" style="display: inline-block;">In case that you were not already a Gault&Millau user, a temporary account with your email has been temporarily created by a Gault&Millau administrator.
|
<span class="letter__unsubscribe-dscr" style="display: inline-block;">In case that you were not already a Gault&Millau user, a temporary account with your email has been temporarily created by a Gault&Millau administrator.
|
||||||
By completing the creation process of your account, you agree to have this account permanently created.
|
By completing the creation process of your account, you agree to have this account permanently created.
|
||||||
This temporary account will be deleted after 7 days if you don't complete the registration process. Please contact %license_contact_email% if you have any questions. </span>
|
This temporary account will be deleted after 7 days if you don't complete the registration process. Please contact {{ contact_email }} if you have any questions. </span>
|
||||||
</div>
|
</div>
|
||||||
<div class="letter__footer" style="padding: 24px 0 15px;text-align: center;background: #ffee29;">
|
<div class="letter__footer" style="padding: 24px 0 15px;text-align: center;background: #ffee29;">
|
||||||
<div class="letter__footer-logo" style="width: 71px;height: 42px;margin: 0 auto 14px auto;">
|
<div class="letter__footer-logo" style="width: 71px;height: 42px;margin: 0 auto 14px auto;">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user