浏览代码

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

Damien ACCORSI 10 年前
父节点
当前提交
a388e3c717

二进制
tracim/tracim/i18n/fr/LC_MESSAGES/tracim.mo 查看文件


+ 22 - 15
tracim/tracim/i18n/fr/LC_MESSAGES/tracim.po 查看文件

7
 msgstr ""
7
 msgstr ""
8
 "Project-Id-Version: pod 0.1\n"
8
 "Project-Id-Version: pod 0.1\n"
9
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
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
 "Last-Translator: Damien Accorsi <damien.accorsi@free.fr>\n"
12
 "Last-Translator: Damien Accorsi <damien.accorsi@free.fr>\n"
13
 "Language-Team: fr_FR <LL@li.org>\n"
13
 "Language-Team: fr_FR <LL@li.org>\n"
14
 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
14
 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
144
 msgstr "{} non restauré(e) : {}"
144
 msgstr "{} non restauré(e) : {}"
145
 
145
 
146
 #: tracim/controllers/content.py:42
146
 #: tracim/controllers/content.py:42
147
-#| msgid "Item commented"
148
 msgid "Comment"
147
 msgid "Comment"
149
 msgstr "Commentaire"
148
 msgstr "Commentaire"
150
 
149
 
202
 msgstr "Dossier non mis à jour : {}"
201
 msgstr "Dossier non mis à jour : {}"
203
 
202
 
204
 #: tracim/controllers/content.py:730
203
 #: tracim/controllers/content.py:730
205
-#| msgid "Folders"
206
 msgid "Folder"
204
 msgid "Folder"
207
 msgstr "Dossiers"
205
 msgstr "Dossiers"
208
 
206
 
371
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
369
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
372
 
370
 
373
 #: tracim/lib/predicates.py:69
371
 #: tracim/lib/predicates.py:69
374
-#| msgid "You are not authorized to access this resource"
375
 msgid "You're not allowed to access this resource"
372
 msgid "You're not allowed to access this resource"
376
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
373
 msgstr "Vous n'êtes pas autorisé à accéder à cette ressource"
377
 
374
 
489
 msgstr "discussion close — annulée"
486
 msgstr "discussion close — annulée"
490
 
487
 
491
 #: tracim/model/data.py:292
488
 #: tracim/model/data.py:292
492
-#| msgid "Delete current workspace"
493
 msgid "Delete this workspace"
489
 msgid "Delete this workspace"
494
 msgstr "Supprimer l'espace de travail"
490
 msgstr "Supprimer l'espace de travail"
495
 
491
 
496
 #: tracim/model/data.py:293
492
 #: tracim/model/data.py:293
497
-#| msgid "Create this folder"
498
 msgid "Delete this folder"
493
 msgid "Delete this folder"
499
 msgstr "Supprimer ce dossier"
494
 msgstr "Supprimer ce dossier"
500
 
495
 
501
 #: tracim/model/data.py:294
496
 #: tracim/model/data.py:294
502
-#| msgid "Delete file"
503
 msgid "Delete this file"
497
 msgid "Delete this file"
504
 msgstr "Supprimer le fichier"
498
 msgstr "Supprimer le fichier"
505
 
499
 
506
 #: tracim/model/data.py:295
500
 #: tracim/model/data.py:295
507
-#| msgid "Create this page"
508
 msgid "Delete this page"
501
 msgid "Delete this page"
509
 msgstr "Supprimer cette page"
502
 msgstr "Supprimer cette page"
510
 
503
 
511
 #: tracim/model/data.py:296
504
 #: tracim/model/data.py:296
512
-#| msgid "Delete thread"
513
 msgid "Delete this thread"
505
 msgid "Delete this thread"
514
 msgstr "Supprimer cette discussion"
506
 msgstr "Supprimer cette discussion"
515
 
507
 
516
 #: tracim/model/data.py:297
508
 #: tracim/model/data.py:297
517
-#| msgid "Item commented"
518
 msgid "Delete this comment"
509
 msgid "Delete this comment"
519
 msgstr "Supprimer ce commentaire"
510
 msgstr "Supprimer ce commentaire"
520
 
511
 
664
 msgstr "vous DEVEZ désactiver le mode \"debug\" en production"
655
 msgstr "vous DEVEZ désactiver le mode \"debug\" en production"
665
 
656
 
666
 #: tracim/templates/master_authenticated.mak:119
657
 #: tracim/templates/master_authenticated.mak:119
667
-#| msgid "Search..."
668
 msgid "Search for..."
658
 msgid "Search for..."
669
 msgstr "Rechercher..."
659
 msgstr "Rechercher..."
670
 
660
 
671
 #: tracim/templates/master_authenticated.mak:121
661
 #: tracim/templates/master_authenticated.mak:121
672
-#| msgid "Search..."
673
 msgid "Search"
662
 msgid "Search"
674
 msgstr "Rechercher..."
663
 msgstr "Rechercher..."
675
 
664
 
864
 msgid "Administrator"
853
 msgid "Administrator"
865
 msgstr "Administrateur"
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
 msgid "User enabled. Click to disable this user"
861
 msgid "User enabled. Click to disable this user"
869
 msgstr "Utilisateur activé. Cliquez pour le désactiver"
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
 msgid "User disabled. Click to enable this user"
865
 msgid "User disabled. Click to enable this user"
873
 msgstr "Utilisateur désactivé. Cliquez pour l'activer"
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
 #: tracim/templates/user_get_me.mak:5
882
 #: tracim/templates/user_get_me.mak:5
876
 #: tracim/templates/user_get_one.mak:5
883
 #: tracim/templates/user_get_one.mak:5
877
 #: tracim/templates/user_profile.mak:5
884
 #: tracim/templates/user_profile.mak:5

+ 2 - 0
tracim/tracim/model/auth.py 查看文件

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

+ 1 - 0
tracim/tracim/model/serializers.py 查看文件

690
     result['email'] = user.email
690
     result['email'] = user.email
691
     result['enabled'] = user.is_active
691
     result['enabled'] = user.is_active
692
     result['profile'] = user.profile
692
     result['profile'] = user.profile
693
+    result['has_password'] = user.password!=None
693
     return result
694
     return result
694
 
695
 
695
 
696
 

+ 12 - 0
tracim/tracim/templates/user_get_all.mak 查看文件

93
                                     <th>${_('Email')}</th>
93
                                     <th>${_('Email')}</th>
94
                                     <th>${_('Can create workspaces')}</th>
94
                                     <th>${_('Can create workspaces')}</th>
95
                                     <th>${_('Administrator')}</th>
95
                                     <th>${_('Administrator')}</th>
96
+                                    <th>${_('Notes')}</th>
96
                                 </tr>
97
                                 </tr>
97
                             </thead>
98
                             </thead>
98
                             % for user in result.users:
99
                             % for user in result.users:
129
                                             ${TIM.ICO(16, icon)}
130
                                             ${TIM.ICO(16, icon)}
130
                                         </td>
131
                                         </td>
131
                                     % endif
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
                                 </tr>
144
                                 </tr>
133
                             % endfor
145
                             % endfor
134
                         </table>
146
                         </table>

+ 13 - 0
tracim/tracim/tests/models/test_user.py 查看文件

32
         eq_(new_user.display_name, name)
32
         eq_(new_user.display_name, name)
33
         eq_(new_user.email, email)
33
         eq_(new_user.email, email)
34
         eq_(new_user.email_address, email)
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))