pull/530/head
ibuler 2016-09-03 19:02:18 +08:00
parent 0b406b6988
commit ba3f46fbd6
2 changed files with 5 additions and 1 deletions

View File

@ -80,6 +80,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
]
ROOT_URLCONF = 'jumpserver.urls'
@ -307,3 +308,5 @@ CELERY_RESULT_BACKEND = BROKER_URL
# Captcha settings, more see https://django-simple-captcha.readthedocs.io/en/latest/advanced.html
CAPTCHA_IMAGE_SIZE = (75, 33)
CAPTCHA_FOREGROUND_COLOR = '#001100'
#

View File

@ -7,6 +7,7 @@ import logging
from django.shortcuts import get_object_or_404, reverse, render, Http404, redirect
from django.http import HttpResponseRedirect
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.db.models import Q
from django.views.generic.base import View, TemplateView
from django.views.generic.list import ListView
@ -50,7 +51,7 @@ class UserLoginView(FormView):
user = authenticate(username=username, password=password)
if user is None:
kwargs.update({'errors': '账号密码不正确'})
kwargs.update({'errors': _('Username or password invalid')})
return self.get(request, *args, **kwargs)
login(request, user)