Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
d284c217
Commit
d284c217
authored
Mar 02, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改一些小问题
parent
f7ab1395
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
23 deletions
+37
-23
asset_list.html
apps/assets/templates/assets/asset_list.html
+6
-6
mixins.py
apps/common/mixins.py
+2
-3
common_tags.py
apps/common/templatetags/common_tags.py
+13
-10
_header_bar.html
apps/templates/_header_bar.html
+1
-1
login.html
apps/users/templates/users/login.html
+6
-2
login.py
apps/users/views/login.py
+9
-1
No files found.
apps/assets/templates/assets/asset_list.html
View file @
d284c217
...
...
@@ -2,6 +2,12 @@
{% load static %}
{% load i18n %}
{% block help_message %}
<div
class=
"alert alert-info help-message"
>
左侧是资产树,右击可以新建、删除、更改树节点,授权资产也是以节点方式组织的,右侧是属于该节点下的资产
</div>
{% endblock %}
{% block custom_head_css_js %}
<link
href=
"{% static 'css/plugins/ztree/awesomeStyle/awesome.css' %}"
rel=
"stylesheet"
>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/ztree/jquery.ztree.all.min.js' %}"
></script>
...
...
@@ -321,12 +327,6 @@ function onDrag(event, treeId, treeNodes) {
}
function
onDrop
(
event
,
treeId
,
treeNodes
,
targetNode
,
moveType
)
{
console
.
log
(
"DROP"
);
console
.
log
(
event
);
console
.
log
(
treeNodes
);
console
.
log
(
targetNode
);
console
.
log
(
moveType
);
var
treeNodesNames
=
[];
var
treeNodesIds
=
[];
$
.
each
(
treeNodes
,
function
(
index
,
value
)
{
...
...
apps/common/mixins.py
View file @
d284c217
...
...
@@ -99,9 +99,8 @@ class DatetimeSearchMixin:
if
date_from_s
:
date_from
=
timezone
.
datetime
.
strptime
(
date_from_s
,
self
.
date_format
)
self
.
date_from
=
date_from
.
replace
(
tzinfo
=
timezone
.
get_current_timezone
()
)
tz
=
timezone
.
get_current_timezone
()
self
.
date_from
=
tz
.
localize
(
date_from
)
else
:
self
.
date_from
=
timezone
.
now
()
-
timezone
.
timedelta
(
7
)
...
...
apps/common/templatetags/common_tags.py
View file @
d284c217
...
...
@@ -73,17 +73,20 @@ def to_html(s):
@register.filter
def
time_util_with_seconds
(
date_from
,
date_to
):
if
date_from
and
date_to
:
delta
=
date_to
-
date_from
seconds
=
delta
.
seconds
if
seconds
<
60
:
return
'{} s'
.
format
(
seconds
)
elif
seconds
<
60
*
60
:
return
'{} m'
.
format
(
seconds
//
60
)
else
:
return
'{} h'
.
format
(
seconds
//
3600
)
else
:
if
not
date_from
:
return
''
if
not
date_to
:
return
''
date_to
=
timezone
.
now
()
delta
=
date_to
-
date_from
seconds
=
delta
.
seconds
if
seconds
<
60
:
return
'{} s'
.
format
(
seconds
)
elif
seconds
<
60
*
60
:
return
'{} m'
.
format
(
seconds
//
60
)
else
:
return
'{} h'
.
format
(
seconds
//
3600
)
@register.filter
...
...
apps/templates/_header_bar.html
View file @
d284c217
...
...
@@ -14,7 +14,7 @@
{#
<span
class=
"m-r-sm text-muted welcome-message"
>
{% trans 'Welcome to use Jumpserver system' %}
</span>
#}
{#
</li>
#}
<li
class=
"dropdown"
>
<a
class=
"dropdown-toggle count-info"
data-toggle=
"dropdown"
href=
"
#
"
>
<a
class=
"dropdown-toggle count-info"
data-toggle=
"dropdown"
href=
"
https://market.aliyun.com/products/53690006/cmgj026011.html?spm=5176.730005.0.0.cY2io1
"
>
<span
class=
"m-r-sm text-muted welcome-message"
>
{% trans 'Supports' %}
</span>
</a>
</li>
...
...
apps/users/templates/users/login.html
View file @
d284c217
...
...
@@ -60,12 +60,16 @@
</div>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
{% trans 'Login' %}
</button>
{% if demo_mode %}
<p
class=
"text-muted font-bold"
style=
"color: red"
>
Demo账号: admin 密码: admin
</p>
{% endif %}
<a
href=
"{% url 'users:forgot-password' %}"
>
<small>
{% trans 'Forgot password' %}?
</small>
</a>
<p
class=
"text-muted text-center"
>
</p>
</form>
<p
class=
"m-t"
>
</p>
...
...
apps/users/views/login.py
View file @
d284c217
# ~*~ coding: utf-8 ~*~
from
__future__
import
unicode_literals
import
os
from
django
import
forms
from
django.shortcuts
import
render
from
django.contrib.auth
import
login
as
auth_login
,
logout
as
auth_logout
...
...
@@ -75,6 +76,13 @@ class UserLoginView(FormView):
self
.
redirect_field_name
,
self
.
request
.
GET
.
get
(
self
.
redirect_field_name
,
reverse
(
'index'
)))
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'demo_mode'
:
os
.
environ
.
get
(
"DEMO_MODE"
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
@method_decorator
(
never_cache
,
name
=
'dispatch'
)
class
UserLogoutView
(
TemplateView
):
...
...
@@ -237,7 +245,7 @@ class LoginLogListView(DatetimeSearchMixin, ListView):
if
self
.
user
:
queryset
=
queryset
.
filter
(
username
=
self
.
user
)
if
self
.
keyword
:
queryset
=
self
.
queryset
.
filter
(
queryset
=
queryset
.
filter
(
Q
(
ip__contains
=
self
.
keyword
)
|
Q
(
city__contains
=
self
.
keyword
)
|
Q
(
username__contains
=
self
.
keyword
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment