jumpserver/templates/juser/user_add.html

212 lines
11 KiB
HTML
Raw Normal View History

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-03-02 10:27:48 +00:00
<h5>填写基本信息</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-03-02 15:32:34 +00:00
<input id="username" name="username" placeholder="Username" type="text" class="form-control" {% if error %}value="{{ username }}" {% endif %}>
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-03-02 15:32:34 +00:00
<input id="password" name="password" placeholder="Password" type="password" class="form-control" {% if error %}value="{{ password }}" {% endif %}>
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-03-02 15:32:34 +00:00
<input id="ssh_key_pwd" name="ssh_key_pwd" placeholder="SSH Key Password" type="password" class="form-control" {% if error %}value="{{ ssh_key_pwd }}" {% endif %}>
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-03-02 15:32:34 +00:00
<input id="name" name="name" placeholder="Name" type="text" class="form-control" {% if error %}value="{{ name }}" {% endif %} >
2015-01-06 15:10:13 +00:00
</div>
2015-01-05 15:46:13 +00:00
</div>
2015-03-23 14:57:19 +00:00
{% ifequal session_role_id 2 %}
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-03-02 15:32:34 +00:00
<label for="dept_id" 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-03-02 15:32:34 +00:00
<select id="dept_id" name="dept_id" class="form-control m-b">
2015-03-02 10:27:48 +00:00
{% for dept in dept_all %}
<option value="{{ dept.id }}">{{ dept.name }}</option>
2015-02-01 15:03:28 +00:00
{% endfor %}
</select>
</div>
</div>
2015-03-23 14:57:19 +00:00
{% endifequal %}
2015-02-01 15:03:28 +00:00
<div class="hr-line-dashed"></div>
<div class="form-group">
2015-03-01 15:34:00 +00:00
<label for="groups" class="col-lg-2 control-label">小组</label>
2015-02-01 15:03:28 +00:00
<div class="col-sm-8">
<select id="groups" name="groups" class="form-control m-b" multiple size="12">
2015-03-02 15:32:34 +00:00
{% for group in group_all %}
{% if forloop.first %}
<option value="{{ group.id }}" selected>{{ group.name }}</option>
2015-01-10 06:07:06 +00:00
{% else %}
2015-03-02 15:32:34 +00:00
<option value="{{ group.id }}">{{ group.name }}</option>
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-03-23 14:57:19 +00:00
{% ifequal session_role_id 2 %}
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-03-23 14:57:19 +00:00
{% endifequal %}
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-30 15:30:16 +00:00
<label for="email" class="col-sm-2 control-label">Email<span class="red-fonts">*</span></label>
2015-01-10 06:57:27 +00:00
<div class="col-sm-8">
2015-03-02 15:32:34 +00:00
<input id="email" name="email" type="email" placeholder="Email" class="form-control" {% if error %}value="{{ email }}" {% endif %}>
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>
<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-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: "必须填写"}
},
2015-03-02 15:32:34 +00:00
"dept_id": {
2015-01-26 16:14:50 +00:00
rule: "checked",
2015-02-01 15:03:28 +00:00
tip: "选择部门",
2015-01-26 16:14:50 +00:00
ok: "",
2015-02-01 15:03:28 +00:00
msg: {checked: "至少选择一个部门"}
2015-01-26 16:14:50 +00:00
},
"name": {
rule: "required",
tip: "姓名",
ok: "",
msg: {required: "必须填写"}
},
2015-01-30 15:30:16 +00:00
"email": {
rule: "required",
tip: "Email",
ok: "",
msg: {required: "必须填写"}
},
2015-01-26 16:14:50 +00:00
"role": {
rule: "checked",
tip: "角色",
ok: "",
msg: {required: "选择一个"}
}
},
valid: function(form) {
form.submit();
}
});
</script>
2015-01-03 14:24:34 +00:00
{% endblock %}