[ckan-changes] commit/ckan: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Fri Sep 2 14:26:49 UTC 2011


2 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/bbc7c136b7c5/
changeset:   bbc7c136b7c5
branch:      release-v1.4.3
user:        amercader
date:        2011-09-01 20:09:54
summary:     Fix for #1030. User can not login again if he has edited his profile
affected #:  2 files (2.1 KB)

--- a/ckan/lib/dictization/model_save.py	Thu Aug 25 12:41:28 2011 +0100
+++ b/ckan/lib/dictization/model_save.py	Thu Sep 01 19:09:54 2011 +0100
@@ -320,6 +320,9 @@
     User = model.User
     if user:
         user_dict['id'] = user.id
+    
+    if 'password' in user_dict and not len(user_dict['password']):
+        del user_dict['password']
 
     user = table_dict_save(user_dict, User, context)
 


--- a/ckan/tests/functional/test_user.py	Thu Aug 25 12:41:28 2011 +0100
+++ b/ckan/tests/functional/test_user.py	Thu Sep 01 19:09:54 2011 +0100
@@ -416,6 +416,59 @@
         main_res = self.main_div(res)
         assert new_about in main_res, main_res
 
+    def test_user_edit_no_password(self):
+        # create user
+        username = 'testedit2'
+        about = u'Test About'
+        user = model.User.by_name(unicode(username))
+        if not user:
+            model.Session.add(model.User(name=unicode(username), about=about,
+                                         password='letmein'))
+            model.repo.commit_and_remove()
+            user = model.User.by_name(unicode(username))
+
+        old_password = user.password    
+
+        # edit
+        new_about = u'Changed about'
+        offset = url_for(controller='user', action='edit', id=user.id)
+        res = self.app.get(offset, status=200, extra_environ={'REMOTE_USER':username})
+        main_res = self.main_div(res)
+        assert 'Edit User: ' in main_res, main_res
+        assert about in main_res, main_res
+        fv = res.forms['user-edit']
+        fv['about'] = new_about
+        fv['password1'] = ''
+        fv['password2'] = ''
+
+        res = fv.submit('preview', extra_environ={'REMOTE_USER':username})
+        
+        # preview
+        main_res = self.main_div(res)
+        assert 'Edit User: testedit2' in main_res, main_res
+        in_preview = main_res[main_res.find('Preview'):]
+        assert new_about in in_preview, in_preview
+
+        # commit
+        res = fv.submit('save', extra_environ={'REMOTE_USER':username})      
+        assert res.status == 302, self.main_div(res).encode('utf8')
+        res = res.follow()
+        main_res = self.main_div(res)
+        assert 'testedit2' in main_res, main_res
+        assert new_about in main_res, main_res
+
+        # read, not logged in
+        offset = url_for(controller='user', action='read', id=user.id)
+        res = self.app.get(offset, status=200)
+        main_res = self.main_div(res)
+        assert new_about in main_res, main_res
+
+        updated_user = model.User.by_name(unicode(username))
+        new_password = updated_user.password
+
+        # Ensure password has not changed
+        assert old_password == new_password
+
     def test_user_edit_no_user(self):
         offset = url_for(controller='user', action='edit', id=None)
         res = self.app.get(offset, status=400)


http://bitbucket.org/okfn/ckan/changeset/9b08d0590304/
changeset:   9b08d0590304
user:        dread
date:        2011-09-02 16:26:40
summary:     [merge] from release-1.4.3 (nop).
affected #:  1 file (0 bytes)

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list