From 9fb71ade7113f3f5a9060bbe6780e1ca1b3bd7db Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 17 Dec 2015 10:08:38 +0800 Subject: [PATCH] remove install wizzrd --- jumpserver/urls.py | 2 - jumpserver/views.py | 74 --------- templates/install.html | 359 ----------------------------------------- 3 files changed, 435 deletions(-) delete mode 100644 templates/install.html diff --git a/jumpserver/urls.py b/jumpserver/urls.py index 63e907f89..4bce88592 100644 --- a/jumpserver/urls.py +++ b/jumpserver/urls.py @@ -13,8 +13,6 @@ urlpatterns = patterns('jumpserver.views', url(r'^file/download/$', 'download', name='file_download'), url(r'^setting', 'setting', name='setting'), url(r'^terminal/$', 'web_terminal', name='terminal'), - url(r'^install/$', 'install', name='install'), - url(r'^install/test/(\w+)/$', 'install_test', name='install_test'), url(r'^juser/', include('juser.urls')), url(r'^jasset/', include('jasset.urls')), url(r'^jlog/', include('jlog.urls')), diff --git a/jumpserver/views.py b/jumpserver/views.py index 6fa41a0f6..bd00aed99 100644 --- a/jumpserver/views.py +++ b/jumpserver/views.py @@ -356,77 +356,3 @@ def web_terminal(request): return render_to_response('jlog/web_terminal.html', locals()) -def install(request): - if request.method == 'POST': - username = request.GET.get('username') - password = request.GET.get('password') - email = request.GET.get('email') - db_host = request.GET.get('db_host') - db_port = int(request.GET.get('db_port')) if request.GET.get('db_port') else 1 - db_user = request.GET.get('db_user') - db_pass = request.GET.get('db_pass') - db = request.GET.get('db') - smtp_host = request.GET.get('smtp_host') if request.GET.get('smtp_host') else 'jumpserver' - smtp_port = int(request.GET.get('smtp_port')) if request.GET.get('smtp_port') else 25 - mail_addr = request.GET.get('mail_addr') - mail_pass = request.GET.get('mail_pass') - - config = ConfigParser.ConfigParser() - config.read(os.path.join(BASE_DIR, 'jumpserver.conf')) - config.set('db', 'host', db_host) - config.set('db', 'port', db_port) - config.set('db', 'user', db_user) - config.set('db', 'password', db_pass) - config.set('db', 'database', db) - config.set('mail', 'email_host', smtp_host) - config.set('mail', 'email_port', smtp_port) - config.set('mail', 'email_host_user', mail_addr) - config.set('mail', 'email_host_passoword', mail_pass) - f = open(os.path.join(BASE_DIR, 'jumpserver.conf'), 'w') - config.write(f) - - return render_to_response('install.html', locals()) - - -def install_test(request, offset): - if request.method == 'GET': - if offset == 'db': - import MySQLdb - db_host = request.GET.get('db_host') - db_port = int(request.GET.get('db_port')) if request.GET.get('db_port') else 1 - db_user = request.GET.get('db_user') - db_pass = request.GET.get('db_pass') - db = request.GET.get('db') - - try: - conn = MySQLdb.connect(host=db_host, port=db_port, user=db_user, passwd=db_pass, db=db) - except Exception, e: - logger.debug(u'测试连接数据库失败: %s %s % s %s' % (db_host, db_port, db_user, db_pass)) - return HttpResponse(u'链接失败 %s' % e, status=500) - else: - return HttpResponse('连接成功') - - elif offset == 'mail': - from smtplib import SMTP - smtp_host = request.GET.get('smtp_host') if request.GET.get('smtp_host') else 'jumpserver' - smtp_port = int(request.GET.get('smtp_port')) if request.GET.get('smtp_port') else 25 - mail_addr = request.GET.get('mail_addr') - mail_pass = request.GET.get('mail_pass') - - try: - smtp = SMTP(smtp_host, port=smtp_port, timeout=2) - smtp.login(mail_addr, mail_pass) - smtp.sendmail(mail_addr, (mail_addr), - '''From:%s\r\nTo:%s\r\nSubject:Jumpserver Mail Test!\r\n\r\n Mail test passed!\r\n''' % - (mail_addr, mail_addr)) - smtp.quit() - - except Exception, e: - logger.debug(u'邮件测试失败: %s' % e) - return HttpResponse('测试失败 %s' % e) - else: - return HttpResponse(u'登陆 %s邮箱查看邮件' % mail_addr) - else: - return HttpResponse('请求方法错误') - - diff --git a/templates/install.html b/templates/install.html deleted file mode 100644 index 844c33ab3..000000000 --- a/templates/install.html +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - Jumpserver Install - - - - - - - - - - - - -
-
-
-
-
-
向导
- -
-
-

- 安装向导 -

-

- 请输入相关信息完成安装 -

- -
-

管理员账户

-
-

管理员账号是首次登陆的账号

-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
-
- -
-
-
-
-
-

数据库

-
-

数据库连接信息

-
-
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
- -
-
-
- -

邮件设置

-
-

邮件设置

-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
- -
-
-
- -

完成

-
-

确认信息

-

-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -