Преглед на файлове

fixes bug #70 - empty password result in an internal server error

Damien ACCORSI преди 10 години
родител
ревизия
a388e3c717

BIN
tracim/tracim/i18n/fr/LC_MESSAGES/tracim.mo Целия файл


+ 22 - 15
tracim/tracim/i18n/fr/LC_MESSAGES/tracim.po Целия файл

@@ -7,8 +7,8 @@ msgid ""
7 7
 msgstr ""
8 8
 "Project-Id-Version: pod 0.1\n"
9 9
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10
-"POT-Creation-Date: 2015-03-09 16:56+0100\n"
11
-"PO-Revision-Date: 2015-03-09 17:00+0100\n"
10
+"POT-Creation-Date: 2015-03-10 18:30+0100\n"
11
+"PO-Revision-Date: 2015-03-10 18:32+0100\n"
12 12
 "Last-Translator: Damien Accorsi <damien.accorsi@free.fr>\n"
13 13
 "Language-Team: fr_FR <LL@li.org>\n"
14 14
 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
@@ -144,7 +144,6 @@ msgid "{} not un-deleted: {}"
144 144
 msgstr "{} non restauré(e) : {}"
145 145
 
146 146
 #: tracim/controllers/content.py:42
147
-#| msgid "Item commented"
148 147
 msgid "Comment"
149 148
 msgstr "Commentaire"
150 149
 
@@ -202,7 +201,6 @@ msgid "Folder not updated: {}"
202 201
 msgstr "Dossier non mis à jour : {}"
203 202
 
204 203
 #: tracim/controllers/content.py:730
205
-#| msgid "Folders"
206 204
 msgid "Folder"
207 205
 msgstr "Dossiers"
208 206
 
@@ -371,7 +369,6 @@ msgid "You are not authorized to access this resource"
371 369
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
372 370
 
373 371
 #: tracim/lib/predicates.py:69
374
-#| msgid "You are not authorized to access this resource"
375 372
 msgid "You're not allowed to access this resource"
376 373
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
377 374
 
@@ -489,32 +486,26 @@ msgid "subject closed — cancelled"
489 486
 msgstr "discussion close — annulée"
490 487
 
491 488
 #: tracim/model/data.py:292
492
-#| msgid "Delete current workspace"
493 489
 msgid "Delete this workspace"
494 490
 msgstr "Supprimer l'espace de travail"
495 491
 
496 492
 #: tracim/model/data.py:293
497
-#| msgid "Create this folder"
498 493
 msgid "Delete this folder"
499 494
 msgstr "Supprimer ce dossier"
500 495
 
501 496
 #: tracim/model/data.py:294
502
-#| msgid "Delete file"
503 497
 msgid "Delete this file"
504 498
 msgstr "Supprimer le fichier"
505 499
 
506 500
 #: tracim/model/data.py:295
507
-#| msgid "Create this page"
508 501
 msgid "Delete this page"
509 502
 msgstr "Supprimer cette page"
510 503
 
511 504
 #: tracim/model/data.py:296
512
-#| msgid "Delete thread"
513 505
 msgid "Delete this thread"
514 506
 msgstr "Supprimer cette discussion"
515 507
 
516 508
 #: tracim/model/data.py:297
517
-#| msgid "Item commented"
518 509
 msgid "Delete this comment"
519 510
 msgstr "Supprimer ce commentaire"
520 511
 
@@ -664,12 +655,10 @@ msgid "you MUST desactivate debug in production"
664 655
 msgstr "vous DEVEZ désactiver le mode \"debug\" en production"
665 656
 
666 657
 #: tracim/templates/master_authenticated.mak:119
667
-#| msgid "Search..."
668 658
 msgid "Search for..."
669 659
 msgstr "Rechercher..."
670 660
 
671 661
 #: tracim/templates/master_authenticated.mak:121
672
-#| msgid "Search..."
673 662
 msgid "Search"
674 663
 msgstr "Rechercher..."
675 664
 
@@ -864,14 +853,32 @@ msgstr "Peut créer des espaces de travail"
864 853
 msgid "Administrator"
865 854
 msgstr "Administrateur"
866 855
 
867
-#: tracim/templates/user_get_all.mak:102
856
+#: tracim/templates/user_get_all.mak:96
857
+msgid "Notes"
858
+msgstr "Remarques"
859
+
860
+#: tracim/templates/user_get_all.mak:103
868 861
 msgid "User enabled. Click to disable this user"
869 862
 msgstr "Utilisateur activé. Cliquez pour le désactiver"
870 863
 
871
-#: tracim/templates/user_get_all.mak:118
864
+#: tracim/templates/user_get_all.mak:119
872 865
 msgid "User disabled. Click to enable this user"
873 866
 msgstr "Utilisateur désactivé. Cliquez pour l'activer"
874 867
 
868
+#: tracim/templates/user_get_all.mak:137
869
+msgid "This user has no password. Visit <a href=\"{}\">Reset password</a> page for init."
870
+msgstr "Cet utilisateur n'a pas de mot de passe. Visitez <a href=\"{}\">cette page</a> pour l'initialiser."
871
+
872
+#: tracim/templates/user_get_all.mak:139
873
+#| msgid "Enter password"
874
+msgid "This user has no password."
875
+msgstr "Cet utilisateur n'a pas de mot de passe"
876
+
877
+#: tracim/templates/user_get_all.mak:140
878
+#| msgid "Your password has been changed"
879
+msgid "No password defined."
880
+msgstr "Aucun mot de passe"
881
+
875 882
 #: tracim/templates/user_get_me.mak:5
876 883
 #: tracim/templates/user_get_one.mak:5
877 884
 #: tracim/templates/user_profile.mak:5

+ 2 - 0
tracim/tracim/model/auth.py Целия файл

@@ -199,6 +199,8 @@ class User(DeclarativeBase):
199 199
         :rtype: bool
200 200
 
201 201
         """
202
+        if not self.password:
203
+            return False
202 204
         hash = sha256()
203 205
         hash.update((password + self.password[:64]).encode('utf-8'))
204 206
         return self.password[64:] == hash.hexdigest()

+ 1 - 0
tracim/tracim/model/serializers.py Целия файл

@@ -690,6 +690,7 @@ def serialize_user_list_default(user: User, context: Context):
690 690
     result['email'] = user.email
691 691
     result['enabled'] = user.is_active
692 692
     result['profile'] = user.profile
693
+    result['has_password'] = user.password!=None
693 694
     return result
694 695
 
695 696
 

+ 12 - 0
tracim/tracim/templates/user_get_all.mak Целия файл

@@ -93,6 +93,7 @@
93 93
                                     <th>${_('Email')}</th>
94 94
                                     <th>${_('Can create workspaces')}</th>
95 95
                                     <th>${_('Administrator')}</th>
96
+                                    <th>${_('Notes')}</th>
96 97
                                 </tr>
97 98
                             </thead>
98 99
                             % for user in result.users:
@@ -129,6 +130,17 @@
129 130
                                             ${TIM.ICO(16, icon)}
130 131
                                         </td>
131 132
                                     % endif
133
+                                    <td>
134
+                                        % if False==user.has_password:
135
+                                            <%
136
+                                                url = tg.url('/reset_password')
137
+                                                msg = _('This user has no password. Visit <a href="{}">Reset password</a> page for init.').format(url)
138
+                                            %>
139
+                                            ${TIM.ICO_TOOLTIP(16, 'emblems/emblem-readonly', _('This user has no password.'))}
140
+                                            ${_('No password defined.')}
141
+
142
+                                        % endif
143
+                                    </td>
132 144
                                 </tr>
133 145
                             % endfor
134 146
                         </table>

+ 13 - 0
tracim/tracim/tests/models/test_user.py Целия файл

@@ -32,3 +32,16 @@ class TestUserModel(TestStandard):
32 32
         eq_(new_user.display_name, name)
33 33
         eq_(new_user.email, email)
34 34
         eq_(new_user.email_address, email)
35
+
36
+    def test_null_password(self):
37
+        # Check bug #70 fixed
38
+        # http://tracim.org/workspaces/4/folders/5/threads/70
39
+
40
+        name = 'Damien'
41
+        email = 'tracim@trac.im'
42
+
43
+        user = User()
44
+        user.display_name = name
45
+        user.email = email
46
+
47
+        eq_(False, user.validate_password(None))