2015-01-03 14:42:46 +00:00
|
|
|
|
{% extends 'base.html' %}
|
2015-01-10 15:31:32 +00:00
|
|
|
|
{% load mytags %}
|
2015-01-03 14:24:34 +00:00
|
|
|
|
|
2015-01-26 16:14:50 +00:00
|
|
|
|
|
2015-01-03 14:24:34 +00:00
|
|
|
|
{% block content %}
|
2015-01-03 15:10:09 +00:00
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
2015-01-05 14:35:25 +00:00
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
2015-01-03 14:24:34 +00:00
|
|
|
|
<div class="row">
|
2015-01-05 15:58:51 +00:00
|
|
|
|
<div class="col-lg-10">
|
2015-01-03 14:24:34 +00:00
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
|
<div class="ibox-title">
|
2015-01-05 15:55:05 +00:00
|
|
|
|
<h5>填写基本信息 <small> Add user info.</small></h5>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
<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>
|
|
|
|
|
<ul class="dropdown-menu dropdown-user">
|
2015-01-05 15:52:25 +00:00
|
|
|
|
<li><a href="#">未启用 1</a>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</li>
|
2015-01-05 15:52:25 +00:00
|
|
|
|
<li><a href="#">未启用 2</a>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<a class="close-link">
|
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ibox-content">
|
2015-01-26 16:14:50 +00:00
|
|
|
|
<form method="post" id="userForm" class="form-horizontal" action="">
|
2015-01-10 07:04:34 +00:00
|
|
|
|
{% if error %}
|
|
|
|
|
<div class="alert alert-warning text-center">{{ error }}</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if msg %}
|
|
|
|
|
<div class="alert alert-success text-center">{{ msg }}</div>
|
|
|
|
|
{% endif %}
|
2015-01-24 05:20:52 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="username" class="col-sm-2 control-label">用户名<span class="red-fonts">*</span></label>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-24 05:20:52 +00:00
|
|
|
|
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value={{ username }} {{ readonly }}>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
</div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="password" class="col-sm-2 control-label">密码<span class="red-fonts">*</span></label>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 08:24:44 +00:00
|
|
|
|
<input id="password" name="password" placeholder="Password" type="password" class="form-control" value={{ password }}>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<span class="help-block m-b-none">
|
|
|
|
|
登陆web的密码
|
|
|
|
|
</span>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-10 06:52:35 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-28 07:08:16 +00:00
|
|
|
|
<label for="ssh_key_pwd" class="col-sm-2 control-label">密钥密码<span class="red-fonts">*</span></label>
|
2015-01-10 06:52:35 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-28 07:08:16 +00:00
|
|
|
|
<input id="ssh_key_pwd" name="ssh_key_pwd" placeholder="SSH Key Password" type="password" class="form-control" value="{{ ssh_key_pwd }}">
|
2015-01-10 06:52:35 +00:00
|
|
|
|
<span class="help-block m-b-none">
|
2015-01-10 06:57:27 +00:00
|
|
|
|
登陆 Jumpserver 使用的SSH密钥的密码
|
2015-01-10 06:52:35 +00:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="name" class="col-sm-2 control-label">姓名<span class="red-fonts">*</span></label>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 08:24:44 +00:00
|
|
|
|
<input id="name" name="name" placeholder="Name" type="text" class="form-control" value={{ name }} >
|
2015-01-06 15:10:13 +00:00
|
|
|
|
</div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="groups" class="col-lg-2 control-label">属组<span class="red-fonts">*</span></label>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<select id="groups" name="groups" class="form-control m-b" multiple>
|
2015-01-10 06:52:35 +00:00
|
|
|
|
{% for group in all_group %}
|
2015-01-10 15:39:43 +00:00
|
|
|
|
{% if groups_str %}
|
|
|
|
|
{% if group.id|int2str in groups_str %}
|
|
|
|
|
<option value="{{ group.id }}" selected>{{ group.name }}</option>
|
|
|
|
|
{% else %}
|
|
|
|
|
<option value="{{ group.id }}">{{ group.name }}</option>
|
|
|
|
|
{% endif %}
|
2015-01-10 06:07:06 +00:00
|
|
|
|
{% else %}
|
2015-01-10 08:24:44 +00:00
|
|
|
|
{% if forloop.first %}
|
|
|
|
|
<option value="{{ group.id }}" selected>{{ group.name }}</option>
|
|
|
|
|
{% else %}
|
|
|
|
|
<option value="{{ group.id }}">{{ group.name }}</option>
|
|
|
|
|
{% endif %}
|
2015-01-10 05:10:44 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
2015-01-06 15:10:13 +00:00
|
|
|
|
</select>
|
|
|
|
|
</div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="role" class="col-lg-2 control-label">角色<span class="red-fonts">*</span></label>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<select id="role" name="role" class="form-control m-b">
|
2015-01-10 08:28:09 +00:00
|
|
|
|
{% for r, role_name in user_role.items %}
|
2015-01-10 08:24:44 +00:00
|
|
|
|
{% ifequal r role_post %}
|
|
|
|
|
<option value="{{ r }}" selected>{{ role_name }}</option>
|
|
|
|
|
{% else %}
|
|
|
|
|
<option value="{{ r }}">{{ role_name }}</option>
|
|
|
|
|
{% endifequal %}
|
2015-01-10 05:10:44 +00:00
|
|
|
|
{% endfor %}
|
2015-01-06 15:10:13 +00:00
|
|
|
|
</select>
|
2015-01-06 15:21:07 +00:00
|
|
|
|
</div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:10:13 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="ssh_pwd" class="col-sm-2 control-label">SSH密码</label>
|
2015-01-05 15:58:51 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 08:24:44 +00:00
|
|
|
|
<input id="ssh_pwd" name="ssh_pwd" type="password" placeholder="SSH Password" class="form-control" value="{{ ssh_pwd }}">
|
2015-01-10 05:10:44 +00:00
|
|
|
|
<span class="help-block m-b-none">
|
|
|
|
|
如果使用password方式,该密码是用户在后端服务器的密码
|
|
|
|
|
</span>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-10 06:57:27 +00:00
|
|
|
|
<div class="form-group">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label for="email" class="col-sm-2 control-label">Email</label>
|
2015-01-10 06:57:27 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-10 08:24:44 +00:00
|
|
|
|
<input id="email" name="email" type="email" placeholder="Email" class="form-control" value="{{ email }}">
|
2015-01-10 06:57:27 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-06 15:21:07 +00:00
|
|
|
|
<div class="form-group"><label class="col-sm-2 control-label">是否启用</label>
|
2015-01-05 15:58:51 +00:00
|
|
|
|
<div class="col-sm-8">
|
2015-01-06 15:21:07 +00:00
|
|
|
|
<div class="radio i-checks">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label><input type="radio" value="1" name="is_active" checked>启用 </label>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</div>
|
2015-01-06 15:21:07 +00:00
|
|
|
|
<div class="radio i-checks">
|
2015-01-10 07:15:49 +00:00
|
|
|
|
<label><input type="radio" value="0" name="is_active">禁用 </label>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-01-06 15:36:11 +00:00
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
<div class="form-group">
|
|
|
|
|
<div class="col-sm-4 col-sm-offset-2">
|
2015-01-06 15:21:07 +00:00
|
|
|
|
<button class="btn btn-white" type="submit">取消</button>
|
2015-01-07 10:35:09 +00:00
|
|
|
|
<button id="submit_button" class="btn btn-primary" type="submit">确认保存</button>
|
2015-01-05 15:46:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-01-05 14:35:25 +00:00
|
|
|
|
</div>
|
2015-01-03 14:24:34 +00:00
|
|
|
|
</div>
|
2015-01-05 13:29:49 +00:00
|
|
|
|
</div>
|
2015-01-07 10:35:09 +00:00
|
|
|
|
|
2015-01-26 16:14:50 +00:00
|
|
|
|
<script>
|
|
|
|
|
$('#userForm').validator({
|
|
|
|
|
timely: 2,
|
|
|
|
|
theme: "yellow_right_effect",
|
|
|
|
|
rules: {
|
|
|
|
|
check_ip: [/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, 'ip地址不正确'],
|
|
|
|
|
check_port: [/^\d{1,5}$/, '端口号不正确'],
|
|
|
|
|
type_m: function(element){
|
|
|
|
|
return $("#M").is(":checked");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fields: {
|
|
|
|
|
"username": {
|
|
|
|
|
rule: "required",
|
|
|
|
|
tip: "输入用户名",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
|
},
|
|
|
|
|
"password": {
|
2015-01-27 09:24:33 +00:00
|
|
|
|
rule: "required;length[6~50]",
|
2015-01-26 16:14:50 +00:00
|
|
|
|
tip: "输入密码",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
|
},
|
2015-01-28 07:08:16 +00:00
|
|
|
|
"ssh_key_pwd": {
|
2015-01-27 09:24:33 +00:00
|
|
|
|
rule: "required;length[6~50]",
|
2015-01-26 16:14:50 +00:00
|
|
|
|
tip: "ssh私钥密码",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写"}
|
|
|
|
|
},
|
|
|
|
|
"groups": {
|
|
|
|
|
rule: "checked",
|
|
|
|
|
tip: "选择用户组",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {checked: "至少选择一个组"}
|
|
|
|
|
},
|
|
|
|
|
"name": {
|
|
|
|
|
rule: "required",
|
|
|
|
|
tip: "姓名",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "必须填写"}
|
|
|
|
|
},
|
|
|
|
|
"role": {
|
|
|
|
|
rule: "checked",
|
|
|
|
|
tip: "角色",
|
|
|
|
|
ok: "",
|
|
|
|
|
msg: {required: "选择一个"}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
valid: function(form) {
|
|
|
|
|
form.submit();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
2015-01-03 14:24:34 +00:00
|
|
|
|
{% endblock %}
|