lang: add locale in django and login view
This commit is contained in:
22
accounts/locale/fr/LC_MESSAGES/django.po
Normal file
22
accounts/locale/fr/LC_MESSAGES/django.po
Normal file
@ -0,0 +1,22 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-02-01 13:59+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \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"
|
||||
#: views/login.py:22
|
||||
msgid "Invalid username or password."
|
||||
msgstr "Nom d'utilisateur ou mot de passe incorect."
|
@ -4,6 +4,7 @@ from rest_framework import permissions, status
|
||||
from django.http import HttpRequest
|
||||
from django.contrib.auth import login
|
||||
from rest_framework.authentication import SessionAuthentication
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from ..serializers.login import LoginSerializer
|
||||
|
||||
@ -18,6 +19,6 @@ class LoginView(APIView):
|
||||
serializer.is_valid(raise_exception=True)
|
||||
user = serializer.get_user(data)
|
||||
if user is None:
|
||||
return Response({'login': ['Invalid username or password.']}, status.HTTP_401_UNAUTHORIZED)
|
||||
return Response({'login': [_('Invalid username or password.')]}, status.HTTP_401_UNAUTHORIZED)
|
||||
login(request, user)
|
||||
return Response({'id': user.pk}, status=status.HTTP_200_OK)
|
||||
|
Reference in New Issue
Block a user