Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
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
80071eb9
authored
Jun 30, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
treat KeyInfo as object not tuple
parent
c14af483
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
django_sshkey/models.py
+7
-6
django_sshkey/util.py
+2
-1
No files found.
django_sshkey/models.py
View file @
80071eb9
...
@@ -75,17 +75,18 @@ class UserKey(models.Model):
...
@@ -75,17 +75,18 @@ class UserKey(models.Model):
def
clean
(
self
):
def
clean
(
self
):
try
:
try
:
type
,
b64key
,
comment
,
self
.
fingerprint
=
key_parse
(
self
.
key
)
info
=
key_parse
(
self
.
key
)
if
comment
:
self
.
fingerprint
=
info
.
fingerprint
self
.
key
=
"
%
s
%
s
%
s"
%
(
type
.
decode
(),
b64key
.
decode
(),
comment
)
if
info
.
comment
:
self
.
key
=
"
%
s
%
s
%
s"
%
(
info
.
type
.
decode
(),
info
.
b64key
.
decode
(),
info
.
comment
)
else
:
else
:
self
.
key
=
"
%
s
%
s"
%
(
type
.
decode
(),
b64key
.
decode
())
self
.
key
=
"
%
s
%
s"
%
(
info
.
type
.
decode
(),
info
.
b64key
.
decode
())
except
SSHKeyFormatError
as
e
:
except
SSHKeyFormatError
as
e
:
raise
ValidationError
(
str
(
e
))
raise
ValidationError
(
str
(
e
))
if
not
self
.
name
:
if
not
self
.
name
:
if
not
comment
:
if
not
info
.
comment
:
raise
ValidationError
(
'Name or key comment required'
)
raise
ValidationError
(
'Name or key comment required'
)
self
.
name
=
comment
self
.
name
=
info
.
comment
def
validate_unique
(
self
,
exclude
=
None
):
def
validate_unique
(
self
,
exclude
=
None
):
if
self
.
pk
is
None
:
if
self
.
pk
is
None
:
...
...
django_sshkey/util.py
View file @
80071eb9
...
@@ -146,7 +146,8 @@ def lookup_by_fingerprint_main():
...
@@ -146,7 +146,8 @@ def lookup_by_fingerprint_main():
)
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
try
:
try
:
type
,
b64key
,
comment
,
fingerprint
=
key_parse
(
key
)
info
=
key_parse
(
key
)
fingerprint
=
info
.
fingerprint
except
SSHKeyFormatError
as
e
:
except
SSHKeyFormatError
as
e
:
sys
.
stderr
.
write
(
"Error: "
+
str
(
e
))
sys
.
stderr
.
write
(
"Error: "
+
str
(
e
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
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