mirror of https://github.com/jumpserver/jumpserver
修改一个bug
parent
a6f53fc99d
commit
a25b2df453
|
@ -170,18 +170,23 @@ def login(request):
|
||||||
else:
|
else:
|
||||||
username = request.POST.get('username')
|
username = request.POST.get('username')
|
||||||
password = request.POST.get('password')
|
password = request.POST.get('password')
|
||||||
user = User.objects.get(username=username)
|
user = User.objects.filter(username=username)
|
||||||
if password == user.password:
|
if user:
|
||||||
request.session['username'] = username
|
user = user[0]
|
||||||
if user.is_admin:
|
if user and password == user.password:
|
||||||
request.session['admin'] = 1
|
request.session['username'] = username
|
||||||
elif user.is_superuser:
|
if user.is_admin:
|
||||||
request.session['admin'] = 2
|
request.session['admin'] = 1
|
||||||
|
elif user.is_superuser:
|
||||||
|
request.session['admin'] = 2
|
||||||
|
else:
|
||||||
|
request.session['admin'] = 0
|
||||||
|
return HttpResponseRedirect('/')
|
||||||
else:
|
else:
|
||||||
request.session['admin'] = 0
|
error = '密码错误,请重新输入。'
|
||||||
return HttpResponseRedirect('/')
|
|
||||||
else:
|
else:
|
||||||
error = '密码错误,请重新输入。'
|
error = '用户不存在。'
|
||||||
|
|
||||||
return render_to_response('login.html', {'error': error})
|
return render_to_response('login.html', {'error': error})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue