def login(request): form = AuthenticationForm(request, data=request.data) if form.is_valid(): auth.login(request, form.user_cache) return Response(AuthenticatedUserSerializer(form.user_cache).data) else: return Response(form.get_errors_dict(), status=status.HTTP_400_BAD_REQUEST)
def login(request): """ POST /auth/ with CSRF, username and password will attempt to authenticate new user """ form = AuthenticationForm(request, data=request.data) if form.is_valid(): auth.login(request, form.user_cache) return Response(AuthenticatedUserSerializer(form.user_cache).data, ) else: return Response( form.get_errors_dict(), status=status.HTTP_400_BAD_REQUEST, )
def login(request): form = AuthenticationForm(request) if request.method == 'POST': form = AuthenticationForm(request, data=request.POST) if form.is_valid(): message = _("Welcome back, %(user)s! You have been " "signed in successfully.") messages.success(request, message % {'user': form.user_cache.username}) auth.login(request, form.user_cache) return redirect(settings.LOGIN_REDIRECT_URL) return render(request, 'misago/login.html', {'form': form})
def login(request): form = AuthenticationForm(request) if request.method == 'POST': form = AuthenticationForm(request, data=request.POST) if form.is_valid(): message = _("Welcome back, %(user)s! You have been " "signed in successfully.") messages.success( request, message % {'user': form.user_cache.username}) auth.login(request, form.user_cache) return redirect(settings.LOGIN_REDIRECT_URL) return render(request, 'misago/login.html', {'form': form})
def login(request): """ POST /auth/ with CSRF, username and password will attempt to authenticate new user """ form = AuthenticationForm(request, data=request.data) if form.is_valid(): auth.login(request, form.user_cache) return Response( AuthenticatedUserSerializer(form.user_cache).data, ) else: return Response( form.get_errors_dict(), status=status.HTTP_400_BAD_REQUEST, )