Commit c4447f77 by Scott Duckworth

Merge branch 'release/2.3.2'

parents c7cf91db 5a25a19f
include LICENSE
include README.rst
include README.upgrading.rst
include RELEASE-NOTES.rst
include lookup.py
include lookup.sh
include django-sshkey-lookup
......
......@@ -2,6 +2,12 @@
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)
------------------
......
......@@ -26,4 +26,4 @@
# 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.
__version__ = '2.3.1'
__version__ = '2.3.2'
......@@ -60,8 +60,13 @@ class UserKey(models.Model):
def clean_fields(self, exclude=None):
if not exclude or 'key' not in exclude:
self.key = self.key.strip()
if not self.key:
raise ValidationError({'key': ["This field is required."]})
def clean(self):
self.key = self.key.strip()
if not self.key:
return
try:
pubkey = pubkey_parse(self.key)
except PublicKeyParseError as e:
......
{% load url from future %}
<h1>My Keys</h1>
{% if messages %}
<ul class="messages">
......@@ -6,7 +7,7 @@
{% endfor %}
</ul>
{% 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>
<tr>
<th>Key</th>
......@@ -29,9 +30,9 @@
<td>{{ userkey.last_used|default:"never" }}</td>
<td>
{% 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 %}
<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>
</tr>
{% endfor %}
......
......@@ -255,6 +255,23 @@ class UserKeyCreationTestCase(BaseTestCase):
)
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):
@classmethod
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