mirror of https://github.com/jumpserver/jumpserver
添加install
parent
7d32a9a9e9
commit
5ccffe6c1d
|
@ -10,6 +10,7 @@ urlpatterns = patterns('',
|
||||||
# url(r'^blog/', include('blog.urls')),
|
# url(r'^blog/', include('blog.urls')),
|
||||||
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
(r'^install/', views.install),
|
||||||
(r'^$', views.index),
|
(r'^$', views.index),
|
||||||
(r'^login/$', views.login),
|
(r'^login/$', views.login),
|
||||||
(r'^logout/$', views.logout),
|
(r'^logout/$', views.logout),
|
||||||
|
|
|
@ -207,6 +207,22 @@ def is_super_user(request):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def install(request):
|
||||||
|
user = User.objects.filter(username='admin')
|
||||||
|
if user:
|
||||||
|
return HttpResponseRedirect('/login/')
|
||||||
|
else:
|
||||||
|
u = User(
|
||||||
|
username='admin',
|
||||||
|
password=md5_crypt('admin'),
|
||||||
|
key_pass=md5_crypt('admin'),
|
||||||
|
name='admin',
|
||||||
|
is_admin=False,
|
||||||
|
is_superuser=True,
|
||||||
|
ldap_password=md5_crypt('admin'))
|
||||||
|
u.save()
|
||||||
|
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
"""登录界面"""
|
"""登录界面"""
|
||||||
if request.session.get('username'):
|
if request.session.get('username'):
|
||||||
|
|
Loading…
Reference in New Issue