Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f8dfa252
authored
Feb 21, 2013
by
x
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: copy keys to server on change
parent
4f1b89a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletions
+14
-1
one/views.py
+14
-1
No files found.
one/views.py
View file @
f8dfa252
...
...
@@ -456,9 +456,10 @@ def key_add(request):
key
.
user
=
request
.
user
key
.
full_clean
()
key
.
save
()
_update_keys
(
request
.
user
)
except
ValidationError
as
e
:
messages
.
error
(
request
,
''
.
join
(
e
.
messages
))
except
e
:
except
:
messages
.
error
(
request
,
_
(
'Failed to add public key'
))
return
redirect
(
'/'
)
...
...
@@ -468,6 +469,7 @@ def key_ajax_delete(request):
try
:
key
=
get_object_or_404
(
SshKey
,
id
=
request
.
POST
[
'id'
],
user
=
request
.
user
)
key
.
delete
()
_update_keys
(
request
.
user
)
except
:
messages
.
error
(
request
,
_
(
'Failed to delete public key'
))
return
HttpResponse
(
'OK'
)
...
...
@@ -479,8 +481,19 @@ def key_ajax_reset(request):
det
=
UserCloudDetails
.
objects
.
get
(
user
=
request
.
user
)
det
.
reset_smb
()
det
.
reset_keys
()
_update_keys
(
request
.
user
)
except
:
messages
.
error
(
request
,
_
(
'Failed to reset keys'
))
return
HttpResponse
(
'OK'
)
def
_update_keys
(
user
):
details
=
user
.
cloud_details
password
=
details
.
smb_password
key_list
=
[]
for
key
in
user
.
sshkey_set
.
all
():
key_list
.
append
(
key
.
key
)
user
=
user
.
username
StoreApi
.
updateauthorizationinfo
(
user
,
password
,
key_list
)
# vim: et sw=4 ai fenc=utf8 smarttab :
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