mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of https://git.coding.net/jumpserver/jumpserver into dev
commit
b8abedc5b9
|
@ -451,7 +451,7 @@ def asset_update(request):
|
|||
return HttpResponseRedirect(reverse('asset_detail')+'?id=%s' % asset_id)
|
||||
else:
|
||||
asset_ansible_update([asset], name)
|
||||
return HttpResponseRedirect(reverse('asset_detail')+'/?id=%s' % asset_id)
|
||||
return HttpResponseRedirect(reverse('asset_detail')+'?id=%s' % asset_id)
|
||||
|
||||
|
||||
@require_role('admin')
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#coding: utf8
|
||||
|
||||
[base]
|
||||
url = http://yourIP
|
||||
key = 16位字母数字
|
||||
log = debug | warning
|
||||
url = http://j
|
||||
key = 88aaaf7ffe3c6c04
|
||||
log = debug
|
||||
|
||||
[db]
|
||||
host = 127.0.0.1
|
||||
|
@ -13,12 +13,12 @@ password = mysql234
|
|||
database = jumpserver
|
||||
|
||||
[websocket]
|
||||
web_socket_host = yourIP|yourDomainName:3000
|
||||
web_socket_host = j:3000
|
||||
|
||||
[mail]
|
||||
mail_enable = 1
|
||||
email_host = yourSMTPHost
|
||||
email_port = yourSMTPHost|25
|
||||
email_host_user = yourEmail
|
||||
email_host_password = yourEmailPassword
|
||||
email_host = smtp.exmail.qq.com
|
||||
email_port = 25
|
||||
email_host_user = noreply@jumpserver.org
|
||||
email_host_password = jumpserver1234
|
||||
email_use_tls = True
|
||||
|
|
|
@ -13,6 +13,8 @@ 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')),
|
||||
|
|
|
@ -354,3 +354,49 @@ def web_terminal(request):
|
|||
role_name = request.GET.get('role')
|
||||
web_terminal_uri = 'ws://%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
|
||||
return render_to_response('jlog/web_terminal.html', locals())
|
||||
|
||||
|
||||
def install(request):
|
||||
return render_to_response('install.html', locals())
|
||||
|
||||
|
||||
def install_test(request, offset):
|
||||
if request.method == 'post':
|
||||
if offset == 'db':
|
||||
import MySQLdb
|
||||
db_host = request.GET.get('db_host')
|
||||
db_port = int(request.GET.get('db_port'))
|
||||
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:
|
||||
return HttpResponse('链接失败', status=500)
|
||||
else:
|
||||
return HttpResponse('连接成功')
|
||||
|
||||
elif offset == 'mail':
|
||||
from smtplib import SMTP
|
||||
smtp_host = request.GET.get('smtp_host')
|
||||
smtp_port = request.GET.get('smtp_port')
|
||||
mail_addr = request.GET.get('mail_addr')
|
||||
mail_pass = request.GET.get('mail_pass')
|
||||
|
||||
try:
|
||||
smtp = SMTP(smtp_host, port=smtp_port)
|
||||
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''')
|
||||
smtp.quit()
|
||||
|
||||
except Exception:
|
||||
return HttpResponse('测试失败', status=500)
|
||||
else:
|
||||
return HttpResponse(u'登陆 %s邮箱查看邮件' % mail_addr)
|
||||
else:
|
||||
print request.method
|
||||
return HttpResponse('请求方法错误', status=500)
|
||||
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ def send_mail_retry(request):
|
|||
msg = u"""
|
||||
跳板机地址: %s
|
||||
用户名:%s
|
||||
重设密码:%s/juser/forget_password/
|
||||
重设密码:%s/juser/password/forget/
|
||||
请登录web点击个人信息页面重新生成ssh密钥
|
||||
""" % (URL, user.username, URL)
|
||||
|
||||
|
@ -295,7 +295,7 @@ def forget_password(request):
|
|||
hash_encode = PyCrypt.md5_crypt(str(user.uuid) + str(timestamp) + KEY)
|
||||
msg = u"""
|
||||
Hi %s, 请点击下面链接重设密码!
|
||||
%s/juser/reset_password/?uuid=%s×tamp=%s&hash=%s
|
||||
%s/juser/password/reset/?uuid=%s×tamp=%s&hash=%s
|
||||
""" % (user.name, URL, user.uuid, timestamp, hash_encode)
|
||||
send_mail('忘记跳板机密码', msg, MAIL_FROM, [email], fail_silently=False)
|
||||
msg = u'请登陆邮箱,点击邮件重设密码'
|
||||
|
@ -311,7 +311,7 @@ def reset_password(request):
|
|||
uuid_r = request.GET.get('uuid', '')
|
||||
timestamp = request.GET.get('timestamp', '')
|
||||
hash_encode = request.GET.get('hash', '')
|
||||
action = '/juser/reset_password/?uuid=%s×tamp=%s&hash=%s' % (uuid_r, timestamp, hash_encode)
|
||||
action = '/juser/password/reset/?uuid=%s×tamp=%s&hash=%s' % (uuid_r, timestamp, hash_encode)
|
||||
|
||||
if request.method == 'POST':
|
||||
password = request.POST.get('password')
|
||||
|
|
|
@ -0,0 +1,380 @@
|
|||
/*
|
||||
Common
|
||||
*/
|
||||
|
||||
.wizard,
|
||||
.tabcontrol
|
||||
{
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wizard a,
|
||||
.tabcontrol a
|
||||
{
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.wizard ul,
|
||||
.tabcontrol ul
|
||||
{
|
||||
list-style: none !important;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wizard ul > li,
|
||||
.tabcontrol ul > li
|
||||
{
|
||||
display: block;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Accessibility */
|
||||
.wizard > .steps .current-info,
|
||||
.tabcontrol > .steps .current-info
|
||||
{
|
||||
position: absolute;
|
||||
left: -999em;
|
||||
}
|
||||
|
||||
.wizard > .content > .title,
|
||||
.tabcontrol > .content > .title
|
||||
{
|
||||
position: absolute;
|
||||
left: -999em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Wizard
|
||||
*/
|
||||
|
||||
.wizard > .steps
|
||||
{
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wizard.vertical > .steps
|
||||
{
|
||||
display: inline;
|
||||
float: left;
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.wizard > .steps > ul > li
|
||||
{
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.wizard > .steps > ul > li,
|
||||
.wizard > .actions > ul > li
|
||||
{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.wizard.vertical > .steps > ul > li
|
||||
{
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wizard > .steps a,
|
||||
.wizard > .steps a:hover,
|
||||
.wizard > .steps a:active
|
||||
{
|
||||
display: block;
|
||||
width: auto;
|
||||
margin: 0 0.5em 0.5em;
|
||||
padding: 8px;
|
||||
text-decoration: none;
|
||||
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.wizard > .steps .disabled a,
|
||||
.wizard > .steps .disabled a:hover,
|
||||
.wizard > .steps .disabled a:active
|
||||
{
|
||||
background: #eee;
|
||||
color: #aaa;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.wizard > .steps .current a,
|
||||
.wizard > .steps .current a:hover,
|
||||
.wizard > .steps .current a:active
|
||||
{
|
||||
background: #1AB394;
|
||||
color: #fff;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.wizard > .steps .done a,
|
||||
.wizard > .steps .done a:hover,
|
||||
.wizard > .steps .done a:active
|
||||
{
|
||||
background: #6fd1bd;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.wizard > .steps .error a,
|
||||
.wizard > .steps .error a:hover,
|
||||
.wizard > .steps .error a:active
|
||||
{
|
||||
background: #ED5565 ;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.wizard > .content
|
||||
{
|
||||
background: #eee;
|
||||
display: block;
|
||||
margin: 5px 5px 10px 5px;
|
||||
min-height: 120px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: auto;
|
||||
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.wizard-big.wizard > .content {
|
||||
min-height: 320px;
|
||||
}
|
||||
.wizard.vertical > .content
|
||||
{
|
||||
display: inline;
|
||||
float: left;
|
||||
margin: 0 2.5% 0.5em 2.5%;
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
.wizard > .content > .body
|
||||
{
|
||||
float: left;
|
||||
position: absolute;
|
||||
width: 95%;
|
||||
height: 95%;
|
||||
padding: 2.5%;
|
||||
}
|
||||
|
||||
.wizard > .content > .body ul
|
||||
{
|
||||
list-style: disc !important;
|
||||
}
|
||||
|
||||
.wizard > .content > .body ul > li
|
||||
{
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
.wizard > .content > .body > iframe
|
||||
{
|
||||
border: 0 none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wizard > .content > .body input
|
||||
{
|
||||
display: block;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.wizard > .content > .body input[type="checkbox"]
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.wizard > .content > .body input.error
|
||||
{
|
||||
background: rgb(251, 227, 228);
|
||||
border: 1px solid #fbc2c4;
|
||||
color: #8a1f11;
|
||||
}
|
||||
|
||||
.wizard > .content > .body label
|
||||
{
|
||||
display: inline-block;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.wizard > .content > .body label.error
|
||||
{
|
||||
color: #8a1f11;
|
||||
display: inline-block;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
.wizard > .actions
|
||||
{
|
||||
position: relative;
|
||||
display: block;
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wizard.vertical > .actions
|
||||
{
|
||||
display: inline;
|
||||
float: right;
|
||||
margin: 0 2.5%;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.wizard > .actions > ul
|
||||
{
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.wizard > .actions > ul > li
|
||||
{
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
|
||||
.wizard.vertical > .actions > ul > li
|
||||
{
|
||||
margin: 0 0 0 1em;
|
||||
}
|
||||
|
||||
.wizard > .actions a,
|
||||
.wizard > .actions a:hover,
|
||||
.wizard > .actions a:active
|
||||
{
|
||||
background: #1AB394;
|
||||
color: #fff;
|
||||
display: block;
|
||||
padding: 0.5em 1em;
|
||||
text-decoration: none;
|
||||
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.wizard > .actions .disabled a,
|
||||
.wizard > .actions .disabled a:hover,
|
||||
.wizard > .actions .disabled a:active
|
||||
{
|
||||
background: #eee;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.wizard > .loading
|
||||
{
|
||||
}
|
||||
|
||||
.wizard > .loading .spinner
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Tabcontrol
|
||||
*/
|
||||
|
||||
.tabcontrol > .steps
|
||||
{
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul
|
||||
{
|
||||
position: relative;
|
||||
margin: 6px 0 0 0;
|
||||
top: 1px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li
|
||||
{
|
||||
float: left;
|
||||
margin: 5px 2px 0 0;
|
||||
padding: 1px;
|
||||
|
||||
-webkit-border-top-left-radius: 5px;
|
||||
-webkit-border-top-right-radius: 5px;
|
||||
-moz-border-radius-topleft: 5px;
|
||||
-moz-border-radius-topright: 5px;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li:hover
|
||||
{
|
||||
background: #edecec;
|
||||
border: 1px solid #bbb;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li.current
|
||||
{
|
||||
background: #fff;
|
||||
border: 1px solid #bbb;
|
||||
border-bottom: 0 none;
|
||||
padding: 0 0 1px 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li > a
|
||||
{
|
||||
color: #5f5f5f;
|
||||
display: inline-block;
|
||||
border: 0 none;
|
||||
margin: 0;
|
||||
padding: 10px 30px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li > a:hover
|
||||
{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.tabcontrol > .steps > ul > li.current > a
|
||||
{
|
||||
padding: 15px 30px 10px 30px;
|
||||
}
|
||||
|
||||
.tabcontrol > .content
|
||||
{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 35em;
|
||||
overflow: hidden;
|
||||
border-top: 1px solid #bbb;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.tabcontrol > .content > .body
|
||||
{
|
||||
float: left;
|
||||
position: absolute;
|
||||
width: 95%;
|
||||
height: 95%;
|
||||
padding: 2.5%;
|
||||
}
|
||||
|
||||
.tabcontrol > .content > .body ul
|
||||
{
|
||||
list-style: disc !important;
|
||||
}
|
||||
|
||||
.tabcontrol > .content > .body ul > li
|
||||
{
|
||||
display: list-item;
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -36,5 +36,6 @@
|
|||
} else {
|
||||
$("#"+s1).addClass('active');
|
||||
$('#'+s1+' .'+s2).addClass('active');
|
||||
console.log(s1)
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,289 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Jumpserver Install</title>
|
||||
<!-- <link href="css/bootstrap.min.css" rel="stylesheet"> -->
|
||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- <link href="font-awesome/css/font-awesome.css" rel="stylesheet"> -->
|
||||
<!-- <link href="css/plugins/iCheck/custom.css" rel="stylesheet"> -->
|
||||
<link href="/static/css/plugins/steps/jquery.steps.css" rel="stylesheet">
|
||||
<!-- <link href="css/animate.css" rel="stylesheet"> -->
|
||||
<!-- <link href="css/style.css" rel="stylesheet"> -->
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<style>
|
||||
.wizard-big.wizard > .content {
|
||||
min-height: 320px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<div class="row" >
|
||||
<div class="col-sm-12" >
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">
|
||||
<h5>向导</h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content" style="height: 900px;">
|
||||
<h2>
|
||||
安装向导
|
||||
</h2>
|
||||
<p>
|
||||
请输入相关信息完成安装
|
||||
</p>
|
||||
|
||||
<form id="form" action="#" class="wizard-big" >
|
||||
{# <h1>管理员账户</h1>#}
|
||||
{# <fieldset>#}
|
||||
{# <h2>管理员账号是首次登陆的账号</h2>#}
|
||||
{# <div class="row">#}
|
||||
{# <div class="col-sm-6">#}
|
||||
{# <div class="form-group">#}
|
||||
{# <label>用户名 *</label>#}
|
||||
{# <input id="username" name="username" type="text" class="form-control required" minlength="5" >#}
|
||||
{# </div>#}
|
||||
{# <div class="form-group">#}
|
||||
{# <label>密码 *</label>#}
|
||||
{# <input id="password" name="password" type="password" class="form-control required password" minlength="8">#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="col-sm-6">#}
|
||||
{# <div class="form-group">#}
|
||||
{# <label>邮件 *</label>#}
|
||||
{# <input id="email" name="email" type="email" class="form-control required">#}
|
||||
{# </div>#}
|
||||
{# <div class="form-group">#}
|
||||
{# <label>确认密码 *</label>#}
|
||||
{# <input id="pass_confirm" name="pass_confirm" type="password" equalto="#password" class="form-control required">#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="col-sm-4">#}
|
||||
{# <div class="text-center">#}
|
||||
{# <div style="margin-top: 20px">#}
|
||||
{# <i class="fa fa-sign-in" style="font-size: 180px;color: #e5e5e5 "></i>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </fieldset>#}
|
||||
<h1>数据库</h1>
|
||||
<fieldset>
|
||||
<h2>数据库连接信息</h2>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>地址 *</label>
|
||||
<input id="db_host" name="db_host" type="text" class="form-control required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>端口 *</label>
|
||||
<input id="db_port" name="db_port" type="text" class="form-control required number">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>数据库 *</label>
|
||||
<input id="db" name="db" type="text" class="form-control required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>用户名 *</label>
|
||||
<input id="db_user" name="db_user" type="text" class="form-control required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>密码 *</label>
|
||||
<input id="db_pass" name="db_pass" type="password" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div></div>
|
||||
<a id="db_btn" value="{% url 'install_test' 'db' %}" class="btn btn-sm btn-warning" style="float: right"> 测试连接 </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<h1>邮件设置</h1>
|
||||
<fieldset>
|
||||
<h2>邮件设置</h2>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>SMTP *</label>
|
||||
<input id="smtp_host" name="smtp_host" type="text" class="form-control required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>端口 *</label>
|
||||
<input id="smtp_port" name="smtp_port" type="text" class="form-control required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label>邮件地址 *</label>
|
||||
<input id="mail_addr" name="mail_addr" type="text" class="form-control required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>密码 *</label>
|
||||
<input id="mail_pass" name="mail_pass" type="password" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div></div>
|
||||
<a id="mail_btn" href="{% url 'install_test' 'mail' %}" class="btn btn-sm btn-warning" style="float: right"> 测试邮件 </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<h1>完成</h1>
|
||||
<fieldset>
|
||||
<h2>Terms and Conditions</h2>
|
||||
<input id="acceptTerms" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms">I agree with the Terms and Conditions.</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Mainly scripts -->
|
||||
<!-- // <script src="js/jquery-2.1.1.js"></script> -->
|
||||
<script src="/static/js/jquery-2.1.1.js"></script>
|
||||
<script src="/static/js/bootstrap.min.js"></script>
|
||||
<!-- // <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
|
||||
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
|
||||
<!-- // <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script> -->
|
||||
|
||||
<!-- Custom and plugin javascript -->
|
||||
<!-- // <script src="js/inspinia.js"></script> -->
|
||||
<!-- // <script src="js/plugins/pace/pace.min.js"></script> -->
|
||||
|
||||
<!-- Steps -->
|
||||
<script src="/static/js/plugins/steps/jquery.steps.min.js"></script>
|
||||
|
||||
<!-- Jquery Validate -->
|
||||
<script src="/static/js/plugins/validate/jquery.validate.min.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
// $("#wizard").steps();
|
||||
|
||||
$('#db_btn').click(function(){
|
||||
console.log('hello');
|
||||
var db_host = $('#db_host').val();
|
||||
var db_port = $('#db_port').val();
|
||||
var db_user = $('#db_user').val();
|
||||
var db_pass = $('#db_pass').val();
|
||||
$.post(
|
||||
$(this).attr('value'),
|
||||
{'db_host': db_host,
|
||||
'db_port': db_port,
|
||||
'db_user': db_user,
|
||||
'db_pass': db_pass
|
||||
},
|
||||
function(data, status){
|
||||
alert(data)
|
||||
}
|
||||
|
||||
);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
$("#form").steps({
|
||||
bodyTag: "fieldset",
|
||||
onStepChanging: function (event, currentIndex, newIndex)
|
||||
{
|
||||
// Always allow going backward even if the current step contains invalid fields!
|
||||
if (currentIndex > newIndex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Forbid suppressing "Warning" step if the user is to young
|
||||
if (newIndex === 3 && Number($("#age").val()) < 18)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var form = $(this);
|
||||
|
||||
// Clean up if user went backward before
|
||||
if (currentIndex < newIndex)
|
||||
{
|
||||
// To remove error styles
|
||||
$(".body:eq(" + newIndex + ") label.error", form).remove();
|
||||
$(".body:eq(" + newIndex + ") .error", form).removeClass("error");
|
||||
}
|
||||
|
||||
// Disable validation on fields that are disabled or hidden.
|
||||
form.validate().settings.ignore = ":disabled,:hidden";
|
||||
|
||||
// Start validation; Prevent going forward if false
|
||||
return form.valid();
|
||||
},
|
||||
onStepChanged: function (event, currentIndex, priorIndex)
|
||||
{
|
||||
// Suppress (skip) "Warning" step if the user is old enough.
|
||||
if (currentIndex === 2 && Number($("#age").val()) >= 18)
|
||||
{
|
||||
$(this).steps("next");
|
||||
}
|
||||
|
||||
// Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
|
||||
if (currentIndex === 2 && priorIndex === 3)
|
||||
{
|
||||
$(this).steps("previous");
|
||||
}
|
||||
},
|
||||
onFinishing: function (event, currentIndex)
|
||||
{
|
||||
var form = $(this);
|
||||
|
||||
// Disable validation on fields that are disabled.
|
||||
// At this point it's recommended to do an overall check (mean ignoring only disabled fields)
|
||||
form.validate().settings.ignore = ":disabled";
|
||||
|
||||
// Start validation; Prevent form submission if false
|
||||
return form.valid();
|
||||
},
|
||||
onFinished: function (event, currentIndex)
|
||||
{
|
||||
var form = $(this);
|
||||
|
||||
// Submit form input
|
||||
form.submit();
|
||||
}
|
||||
}).validate({
|
||||
errorPlacement: function (error, element)
|
||||
{
|
||||
element.before(error);
|
||||
},
|
||||
rules: {
|
||||
confirm: {
|
||||
equalTo: "#password"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -109,8 +109,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('#exec_cmd').click(function(){
|
||||
var url = '{% url "role_get" %} ';
|
||||
$('#exec_cmd').click(function(){
|
||||
var url = '{% url "role_get" %}';
|
||||
var new_url = '{% url "exec_cmd" %}?role=';
|
||||
var check_array = [];
|
||||
$(".gradeX input:checked").closest('tr').find('.hostname a').each(function() {
|
||||
|
@ -155,11 +155,10 @@
|
|||
});
|
||||
|
||||
$('.conn').click(function(){
|
||||
var url='{% url "role_get" %}?id=' + $(this).attr('value');
|
||||
var url='{% url "role_get" %}?id=' + $(this).attr('value'); // 获取用户有权限的角色
|
||||
var href = $(this).attr('href');
|
||||
var new_url = '{% url "terminal" %}?id=' + $(this).attr('value') + '&role=';
|
||||
var new_url = '{% url "terminal" %}?id=' + $(this).attr('value') + '&role='; // webterminal socket url
|
||||
var hostname = $(this).closest('tr').find('.hostname a')[0].innerHTML;
|
||||
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
|
@ -168,17 +167,19 @@
|
|||
var dataArray = data.split(',');
|
||||
if (data == 'error' || data == '' || data == null || data == undefined){
|
||||
layer.alert('没有授权系统用户')
|
||||
} else if (dataArray.length == 1 && data != 'error' && navigator.platform == 'Win32') {
|
||||
}
|
||||
else if (dataArray.length == 1 && data != 'error' && navigator.platform == 'Win32'){
|
||||
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
shade: false,
|
||||
area: ['628px', '420px'],
|
||||
content: new_url + data
|
||||
content: new_url+data
|
||||
});
|
||||
} else if (dataArray.length == 1 && data != 'error'){
|
||||
layer.open({
|
||||
} else if (dataArray.length == 1 && data != 'error'){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
|
@ -186,12 +187,13 @@
|
|||
area: ['628px', '452px'],
|
||||
content: new_url+data
|
||||
});
|
||||
//window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
aUrl = '';
|
||||
$.each(dataArray, function(index, value){
|
||||
aUrl += '<a onclick="windowOpen(this); return false" class="btn btn-xs btn-primary newa" href=' + new_url + value + ' value=' + hostname + '>' + value + '</a> '
|
||||
});
|
||||
console.log(aUrl);
|
||||
layer.alert(aUrl, {
|
||||
skin: 'layui-layer-molv',
|
||||
title: '授权多个系统用户,请选择一个连接',
|
||||
|
@ -209,27 +211,40 @@
|
|||
var new_url = $(a).attr('href');
|
||||
var hostname = $(a).attr('value');
|
||||
var title = 'Jumpserver Web Terminal - ' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
layer.open({
|
||||
if (navigator.platform == 'Win32'){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['628px', '420px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
|
||||
} else {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['628px', '452px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function windowOpenExec(a){
|
||||
var new_url = $(a).attr('href');
|
||||
var title = 'Jumpserver Exec Terminal';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['800px', '600px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
var new_url = $(a).attr('href');
|
||||
var title = 'Jumpserver Exec Terminal';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['725px', '600px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
console.log(new_url);
|
||||
return false
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
{% for rule in user_rule_perm %}
|
||||
<tr>
|
||||
<td class="text-navy">{{ rule }}</td>
|
||||
<td class="text-navy"><a href="{% url 'rule_detail' %}/?id={{ rule.id }}">详情</a></td>
|
||||
<td class="text-navy"><a href="{% url 'rule_detail' %}?id={{ rule.id }}">详情</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -275,27 +275,40 @@
|
|||
var new_url = $(a).attr('href');
|
||||
var hostname = $(a).attr('value');
|
||||
var title = 'Jumpserver Web Terminal - ' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
layer.open({
|
||||
if (navigator.platform == 'Win32'){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['628px', '420px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
|
||||
} else {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['628px', '452px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function windowOpenExec(a){
|
||||
var new_url = $(a).attr('href');
|
||||
var title = 'Jumpserver Exec Terminal';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['800px', '600px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
var new_url = $(a).attr('href');
|
||||
var title = 'Jumpserver Exec Terminal';
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
area: ['725px', '600px'],
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
console.log(new_url);
|
||||
return false
|
||||
|
|
|
@ -134,7 +134,7 @@ $('#ruleForm').validator({
|
|||
|
||||
fields: {
|
||||
"name": {
|
||||
rule: "required;check_name",
|
||||
rule: "required",
|
||||
tip: "输入规则名称",
|
||||
msg: {required: "规则名称必填"}
|
||||
},
|
||||
|
|
|
@ -106,7 +106,7 @@ function remove_rule(rule_id){
|
|||
if (confirm("确认删除")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/jperm/perm_rule_delete/",
|
||||
url: "{% url 'rule_del' %}",
|
||||
data: "id=" + rule_id,
|
||||
success: function(msg){
|
||||
alert( "成功: " + msg );
|
||||
|
|
Loading…
Reference in New Issue