Commit c4447f77 by Scott Duckworth

Merge branch 'release/2.3.2'

parents c7cf91db 5a25a19f
include LICENSE include LICENSE
include README.rst include README.rst
include README.upgrading.rst include README.upgrading.rst
include RELEASE-NOTES.rst
include lookup.py include lookup.py
include lookup.sh include lookup.sh
include django-sshkey-lookup include django-sshkey-lookup
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
Release Notes for django-sshkey Release Notes for django-sshkey
=============================== ===============================
2.3.2 (2014-09-15)
------------------
* Bug fix #1: entering whitespace for key field results in IndexError
* Make example templates work with Django 1.4+
2.3.1 (2014-07-29) 2.3.1 (2014-07-29)
------------------ ------------------
......
...@@ -26,4 +26,4 @@ ...@@ -26,4 +26,4 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
__version__ = '2.3.1' __version__ = '2.3.2'
...@@ -60,8 +60,13 @@ class UserKey(models.Model): ...@@ -60,8 +60,13 @@ class UserKey(models.Model):
def clean_fields(self, exclude=None): def clean_fields(self, exclude=None):
if not exclude or 'key' not in exclude: if not exclude or 'key' not in exclude:
self.key = self.key.strip() self.key = self.key.strip()
if not self.key:
raise ValidationError({'key': ["This field is required."]})
def clean(self): def clean(self):
self.key = self.key.strip()
if not self.key:
return
try: try:
pubkey = pubkey_parse(self.key) pubkey = pubkey_parse(self.key)
except PublicKeyParseError as e: except PublicKeyParseError as e:
......
{% load url from future %}
<h1>My Keys</h1> <h1>My Keys</h1>
{% if messages %} {% if messages %}
<ul class="messages"> <ul class="messages">
...@@ -6,7 +7,7 @@ ...@@ -6,7 +7,7 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
<p><a href="{% url django_sshkey.views.userkey_add %}">Add Key</a></p> <p><a href="{% url "django_sshkey.views.userkey_add" %}">Add Key</a></p>
<table> <table>
<tr> <tr>
<th>Key</th> <th>Key</th>
...@@ -29,9 +30,9 @@ ...@@ -29,9 +30,9 @@
<td>{{ userkey.last_used|default:"never" }}</td> <td>{{ userkey.last_used|default:"never" }}</td>
<td> <td>
{% if allow_edit %} {% if allow_edit %}
<a href="{% url django_sshkey.views.userkey_edit userkey.pk %}">Edit</a> <a href="{% url "django_sshkey.views.userkey_edit" userkey.pk %}">Edit</a>
{% endif %} {% endif %}
<a href="{% url django_sshkey.views.userkey_delete userkey.pk %}">Delete</a> <a href="{% url "django_sshkey.views.userkey_delete" userkey.pk %}">Delete</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
......
...@@ -255,6 +255,23 @@ class UserKeyCreationTestCase(BaseTestCase): ...@@ -255,6 +255,23 @@ class UserKeyCreationTestCase(BaseTestCase):
) )
self.assertRaises(ValidationError, key2.full_clean) self.assertRaises(ValidationError, key2.full_clean)
def test_blank_key_fails(self):
key = UserKey(
user = self.user1,
name = 'name1',
key = '',
)
self.assertRaises(ValidationError, key.full_clean)
def test_ws_key_fails(self):
key = UserKey(
user = self.user1,
name = 'name1',
key = ' ',
)
self.assertRaises(ValidationError, key.full_clean)
class RFC4716TestCase(BaseTestCase): class RFC4716TestCase(BaseTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment