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
301e02bc
Commit
301e02bc
authored
Dec 29, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update some api
parent
70da177e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
45 deletions
+11
-45
api.py
apps/applications/api.py
+0
-8
terminal_form.html
apps/applications/templates/applications/terminal_form.html
+0
-0
terminal_list.html
apps/applications/templates/applications/terminal_list.html
+2
-4
terminal_modal_accept.bak.html
...ons/templates/applications/terminal_modal_accept.bak.html
+0
-27
terminal_modal_accept.html
...cations/templates/applications/terminal_modal_accept.html
+1
-0
views.py
apps/applications/views.py
+8
-4
authentication.py
apps/users/authentication.py
+0
-2
No files found.
apps/applications/api.py
View file @
301e02bc
...
@@ -64,10 +64,3 @@ class TerminalHeatbeatViewSet(viewsets.ModelViewSet):
...
@@ -64,10 +64,3 @@ class TerminalHeatbeatViewSet(viewsets.ModelViewSet):
terminal
=
request
.
user
.
terminal
terminal
=
request
.
user
.
terminal
TerminalHeatbeat
.
objects
.
create
(
terminal
=
terminal
)
TerminalHeatbeat
.
objects
.
create
(
terminal
=
terminal
)
return
Response
({
'msg'
:
'Success'
},
status
=
201
)
return
Response
({
'msg'
:
'Success'
},
status
=
201
)
class
TestHeatbeat
(
APIView
):
permission_classes
=
(
IsAppUser
,)
def
post
(
self
,
request
):
return
Response
({
'hello'
:
'world'
})
\ No newline at end of file
apps/applications/templates/applications/terminal_form.html
deleted
100644 → 0
View file @
70da177e
apps/applications/templates/applications/terminal_list.html
View file @
301e02bc
...
@@ -122,12 +122,10 @@ $(document).ready(function(){
...
@@ -122,12 +122,10 @@ $(document).ready(function(){
}).
on
(
'click'
,
'#btn_terminal_accept'
,
function
()
{
}).
on
(
'click'
,
'#btn_terminal_accept'
,
function
()
{
var
$form
=
$
(
'#form_terminal_accept'
);
var
$form
=
$
(
'#form_terminal_accept'
);
function
success
(
data
,
textStatus
,
jqXHR
)
{
function
success
(
data
,
textStatus
,
jqXHR
)
{
if
(
data
.
success
===
false
)
{
if
(
data
.
success
===
true
)
{
console
.
log
(
data
.
msg
);
window
.
location
.
reload
()
window
.
location
.
reload
()
}
else
{
}
else
{
console
.
log
(
data
.
msg
);
$
(
'#modal-error'
).
html
(
data
.
msg
).
css
(
'display'
,
'block'
);
}
}
}
}
$form
.
ajaxSubmit
({
success
:
success
});
$form
.
ajaxSubmit
({
success
:
success
});
...
...
apps/applications/templates/applications/terminal_modal_accept.bak.html
deleted
100644 → 0
View file @
70da177e
{% extends '_modal.html' %}
{% load static %}
{% load bootstrap %}
{% load i18n %}
{% block modal_body %}
<form
action=
""
method=
"post"
class=
"form-horizontal"
>
{% csrf_token %}
{{ form.name|bootstrap_horizontal }}
{{ form.remote_addr|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
{{ form.url|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-default"
type=
"reset"
>
{% trans 'Reset' %}
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
{% trans 'Submit' %}
</button>
</div>
</div>
</form>
{% endblock %}
{% block custom_foot_js %}
{% endblock %}
\ No newline at end of file
apps/applications/templates/applications/terminal_modal_accept.html
View file @
301e02bc
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
{% load bootstrap %}
{% load bootstrap %}
<form
action=
"{% url 'applications:terminal-modal-accept' pk="
99991937
"
%}"
method=
"post"
class=
"form-horizontal"
id=
"form_terminal_accept"
>
<form
action=
"{% url 'applications:terminal-modal-accept' pk="
99991937
"
%}"
method=
"post"
class=
"form-horizontal"
id=
"form_terminal_accept"
>
{% csrf_token %}
{% csrf_token %}
<p
class=
"alert alert-danger"
id=
"modal-error"
style=
"display: none"
></p>
{{ form.name|bootstrap_horizontal }}
{{ form.name|bootstrap_horizontal }}
{{ form.remote_addr|bootstrap_horizontal }}
{{ form.remote_addr|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
...
...
apps/applications/views.py
View file @
301e02bc
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#
#
from
django.views.generic
import
ListView
,
UpdateView
,
DeleteView
,
FormView
from
django.views.generic
import
ListView
,
UpdateView
,
DeleteView
,
FormView
from
django.views.generic.edit
import
BaseUpdateView
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
from
django.urls
import
reverse_lazy
from
django.urls
import
reverse_lazy
...
@@ -44,10 +45,14 @@ class TerminalDeleteView(DeleteView):
...
@@ -44,10 +45,14 @@ class TerminalDeleteView(DeleteView):
success_url
=
reverse_lazy
(
'applications:applications-list'
)
success_url
=
reverse_lazy
(
'applications:applications-list'
)
class
TerminalModelAccept
(
AdminUserRequiredMixin
,
JSONResponseMixin
,
UpdateView
):
class
TerminalModelAccept
(
AdminUserRequiredMixin
,
JSONResponseMixin
,
Base
UpdateView
):
model
=
Terminal
model
=
Terminal
form_class
=
TerminalForm
form_class
=
TerminalForm
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
print
(
request
.
POST
)
return
super
(
TerminalModelAccept
,
self
)
.
post
(
request
,
*
args
,
**
kwargs
)
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
terminal
=
form
.
save
()
terminal
=
form
.
save
()
terminal
.
is_accepted
=
True
terminal
.
is_accepted
=
True
...
@@ -57,14 +62,13 @@ class TerminalModelAccept(AdminUserRequiredMixin, JSONResponseMixin, UpdateView)
...
@@ -57,14 +62,13 @@ class TerminalModelAccept(AdminUserRequiredMixin, JSONResponseMixin, UpdateView)
'success'
:
True
,
'success'
:
True
,
'msg'
:
'success'
'msg'
:
'success'
}
}
print
(
'Valid'
)
return
self
.
render_json_response
(
data
)
return
self
.
render_json_response
(
data
)
def
form_invalid
(
self
,
form
):
def
form_invalid
(
self
,
form
):
print
(
form
.
errors
)
print
(
'form.data'
)
data
=
{
data
=
{
'success'
:
False
,
'success'
:
False
,
'msg'
:
','
.
join
(
form
.
errors
)
'msg'
:
str
(
form
.
errors
),
}
}
return
self
.
render_json_response
(
data
)
return
self
.
render_json_response
(
data
)
...
...
apps/users/authentication.py
View file @
301e02bc
...
@@ -65,8 +65,6 @@ class AccessKeyAuthentication(authentication.BaseAuthentication):
...
@@ -65,8 +65,6 @@ class AccessKeyAuthentication(authentication.BaseAuthentication):
raise
exceptions
.
AuthenticationFailed
(
_
(
'Invalid signature.'
))
raise
exceptions
.
AuthenticationFailed
(
_
(
'Invalid signature.'
))
access_key_secret
=
access_key
.
secret
access_key_secret
=
access_key
.
secret
print
(
request_date
)
try
:
try
:
request_unix_time
=
http_to_unixtime
(
request_date
)
request_unix_time
=
http_to_unixtime
(
request_date
)
except
ValueError
:
except
ValueError
:
...
...
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