##// END OF EJS Templates
Don't allow characters in username that we cannot use as a URL
neko259 -
r995:64602f45 default
parent child Browse files
Show More
@@ -327,6 +327,14 b' class SettingsForm(NeboardForm):'
327 label=_('Theme'))
327 label=_('Theme'))
328 username = forms.CharField(label=_('User name'), required=False)
328 username = forms.CharField(label=_('User name'), required=False)
329
329
330 def clean_username(self):
331 username = self.cleaned_data['username']
332
333 if username and not REGEX_TAGS.match(username):
334 raise forms.ValidationError(_('Inappropriate characters.'))
335
336 return username
337
330
338
331 class SearchForm(NeboardForm):
339 class SearchForm(NeboardForm):
332 query = forms.CharField(max_length=500, label=LABEL_SEARCH, required=False)
340 query = forms.CharField(max_length=500, label=LABEL_SEARCH, required=False)
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -7,7 +7,7 b' msgid ""'
7 msgstr ""
7 msgstr ""
8 "Project-Id-Version: PACKAGE VERSION\n"
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "Report-Msgid-Bugs-To: \n"
9 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2015-02-21 20:03+0200\n"
10 "POT-Creation-Date: 2015-02-24 08:32+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -124,6 +124,10 b' msgstr "\xd0\xa2\xd0\xb5\xd0\xbc\xd0\xb0"'
124 msgid "User name"
124 msgid "User name"
125 msgstr "Имя ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ"
125 msgstr "Имя ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ"
126
126
127 #: forms.py:334
128 msgid "Inappropriate characters."
129 msgstr "НСдопустимыС символы."
130
127 #: templates/boards/404.html:6
131 #: templates/boards/404.html:6
128 msgid "Not found"
132 msgid "Not found"
129 msgstr "НС найдСно"
133 msgstr "НС найдСно"
@@ -160,7 +164,7 b' msgstr "\xd0\x92\xd1\x81\xd0\xb5 \xd1\x82\xd0\xb5\xd0\xbc\xd1\x8b"'
160 msgid "Tag management"
164 msgid "Tag management"
161 msgstr "Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΌΠ΅Ρ‚ΠΊΠ°ΠΌΠΈ"
165 msgstr "Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΌΠ΅Ρ‚ΠΊΠ°ΠΌΠΈ"
162
166
163 #: templates/boards/base.html:41
167 #: templates/boards/base.html:41 templates/boards/notifications.html:7
164 msgid "Notifications"
168 msgid "Notifications"
165 msgstr "УвСдомлСния"
169 msgstr "УвСдомлСния"
166
170
@@ -193,13 +197,13 b' msgstr "\xd0\x92\xd1\x85\xd0\xbe\xd0\xb4"'
193 msgid "Insert your user id above"
197 msgid "Insert your user id above"
194 msgstr "Π’ΡΡ‚Π°Π²ΡŒΡ‚Π΅ свой ID ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ Π²Ρ‹ΡˆΠ΅"
198 msgstr "Π’ΡΡ‚Π°Π²ΡŒΡ‚Π΅ свой ID ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ Π²Ρ‹ΡˆΠ΅"
195
199
196 #: templates/boards/notifications.html:10
200 #: templates/boards/notifications.html:16
197 #: templates/boards/posting_general.html:85 templates/search/search.html:22
201 #: templates/boards/posting_general.html:85 templates/search/search.html:22
198 msgid "Previous page"
202 msgid "Previous page"
199 msgstr "ΠŸΡ€Π΅Π΄Ρ‹Π΄ΡƒΡ‰Π°Ρ страница"
203 msgstr "ΠŸΡ€Π΅Π΄Ρ‹Π΄ΡƒΡ‰Π°Ρ страница"
200
204
201 #: templates/boards/notifications.html:20
205 #: templates/boards/notifications.html:26
202 #: templates/boards/posting_general.html:127 templates/search/search.html:33
206 #: templates/boards/posting_general.html:125 templates/search/search.html:33
203 msgid "Next page"
207 msgid "Next page"
204 msgstr "Π‘Π»Π΅Π΄ΡƒΡŽΡ‰Π°Ρ страница"
208 msgstr "Π‘Π»Π΅Π΄ΡƒΡŽΡ‰Π°Ρ страница"
205
209
@@ -254,34 +258,34 b' msgstr "\xd0\x98\xd0\xb7\xd0\xbc\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x82\xd1\x8c \xd0\xbc\xd0\xb5\xd1\x82\xd0\xba\xd1\x83"'
254 msgid "This tag has %(thread_count)s threads and %(post_count)s posts."
258 msgid "This tag has %(thread_count)s threads and %(post_count)s posts."
255 msgstr "Π‘ этой ΠΌΠ΅Ρ‚ΠΊΠΎΠΉ Π΅ΡΡ‚ΡŒ %(thread_count)s Ρ‚Π΅ΠΌ ΠΈ %(post_count)s сообщСний."
259 msgstr "Π‘ этой ΠΌΠ΅Ρ‚ΠΊΠΎΠΉ Π΅ΡΡ‚ΡŒ %(thread_count)s Ρ‚Π΅ΠΌ ΠΈ %(post_count)s сообщСний."
256
260
257 #: templates/boards/posting_general.html:100
261 #: templates/boards/posting_general.html:99
258 #, python-format
262 #, python-format
259 msgid "Skipped %(count)s replies. Open thread to see all replies."
263 msgid "Skipped %(count)s replies. Open thread to see all replies."
260 msgstr "ΠŸΡ€ΠΎΠΏΡƒΡ‰Π΅Π½ΠΎ %(count)s ΠΎΡ‚Π²Π΅Ρ‚ΠΎΠ². ΠžΡ‚ΠΊΡ€ΠΎΠΉΡ‚Π΅ Ρ‚Ρ€Π΅Π΄, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΡƒΠ²ΠΈΠ΄Π΅Ρ‚ΡŒ всС ΠΎΡ‚Π²Π΅Ρ‚Ρ‹."
264 msgstr "ΠŸΡ€ΠΎΠΏΡƒΡ‰Π΅Π½ΠΎ %(count)s ΠΎΡ‚Π²Π΅Ρ‚ΠΎΠ². ΠžΡ‚ΠΊΡ€ΠΎΠΉΡ‚Π΅ Ρ‚Ρ€Π΅Π΄, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΡƒΠ²ΠΈΠ΄Π΅Ρ‚ΡŒ всС ΠΎΡ‚Π²Π΅Ρ‚Ρ‹."
261
265
262 #: templates/boards/posting_general.html:132
266 #: templates/boards/posting_general.html:130
263 msgid "No threads exist. Create the first one!"
267 msgid "No threads exist. Create the first one!"
264 msgstr "НСт Ρ‚Π΅ΠΌ. Π‘ΠΎΠ·Π΄Π°ΠΉΡ‚Π΅ ΠΏΠ΅Ρ€Π²ΡƒΡŽ!"
268 msgstr "НСт Ρ‚Π΅ΠΌ. Π‘ΠΎΠ·Π΄Π°ΠΉΡ‚Π΅ ΠΏΠ΅Ρ€Π²ΡƒΡŽ!"
265
269
266 #: templates/boards/posting_general.html:138
270 #: templates/boards/posting_general.html:136
267 msgid "Create new thread"
271 msgid "Create new thread"
268 msgstr "Π‘ΠΎΠ·Π΄Π°Ρ‚ΡŒ Π½ΠΎΠ²ΡƒΡŽ Ρ‚Π΅ΠΌΡƒ"
272 msgstr "Π‘ΠΎΠ·Π΄Π°Ρ‚ΡŒ Π½ΠΎΠ²ΡƒΡŽ Ρ‚Π΅ΠΌΡƒ"
269
273
270 #: templates/boards/posting_general.html:143 templates/boards/preview.html:16
274 #: templates/boards/posting_general.html:141 templates/boards/preview.html:16
271 #: templates/boards/thread.html:54
275 #: templates/boards/thread.html:54
272 msgid "Post"
276 msgid "Post"
273 msgstr "ΠžΡ‚ΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ"
277 msgstr "ΠžΡ‚ΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ"
274
278
275 #: templates/boards/posting_general.html:148
279 #: templates/boards/posting_general.html:146
276 msgid "Tags must be delimited by spaces. Text or image is required."
280 msgid "Tags must be delimited by spaces. Text or image is required."
277 msgstr ""
281 msgstr ""
278 "ΠœΠ΅Ρ‚ΠΊΠΈ Π΄ΠΎΠ»ΠΆΠ½Ρ‹ Π±Ρ‹Ρ‚ΡŒ Ρ€Π°Π·Π΄Π΅Π»Π΅Π½Ρ‹ ΠΏΡ€ΠΎΠ±Π΅Π»Π°ΠΌΠΈ. ВСкст ΠΈΠ»ΠΈ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½Ρ‹."
282 "ΠœΠ΅Ρ‚ΠΊΠΈ Π΄ΠΎΠ»ΠΆΠ½Ρ‹ Π±Ρ‹Ρ‚ΡŒ Ρ€Π°Π·Π΄Π΅Π»Π΅Π½Ρ‹ ΠΏΡ€ΠΎΠ±Π΅Π»Π°ΠΌΠΈ. ВСкст ΠΈΠ»ΠΈ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½Ρ‹."
279
283
280 #: templates/boards/posting_general.html:151 templates/boards/thread.html:59
284 #: templates/boards/posting_general.html:149 templates/boards/thread.html:59
281 msgid "Text syntax"
285 msgid "Text syntax"
282 msgstr "Бинтаксис тСкста"
286 msgstr "Бинтаксис тСкста"
283
287
284 #: templates/boards/posting_general.html:163
288 #: templates/boards/posting_general.html:161
285 msgid "Pages:"
289 msgid "Pages:"
286 msgstr "Π‘Ρ‚Ρ€Π°Π½ΠΈΡ†Ρ‹: "
290 msgstr "Π‘Ρ‚Ρ€Π°Π½ΠΈΡ†Ρ‹: "
287
291
@@ -89,8 +89,7 b''
89 {% for thread in threads %}
89 {% for thread in threads %}
90 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
90 {% cache 600 thread_short thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
91 <div class="thread">
91 <div class="thread">
92 {% with can_bump=thread.can_bump %}
92 {% post_view thread.get_opening_post moderator is_opening=True thread=thread truncated=True need_open_link=True %}
93 {% post_view thread.get_opening_post moderator is_opening=True thread=thread can_bump=can_bump truncated=True need_open_link=True %}
94 {% if not thread.archived %}
93 {% if not thread.archived %}
95 {% with last_replies=thread.get_last_replies %}
94 {% with last_replies=thread.get_last_replies %}
96 {% if last_replies %}
95 {% if last_replies %}
@@ -109,7 +108,6 b''
109 {% endif %}
108 {% endif %}
110 {% endwith %}
109 {% endwith %}
111 {% endif %}
110 {% endif %}
112 {% endwith %}
113 </div>
111 </div>
114 {% endcache %}
112 {% endcache %}
115 {% endfor %}
113 {% endfor %}
@@ -11,11 +11,13 b" FORM_USERNAME = 'username'"
11
11
12 CONTEXT_HIDDEN_TAGS = 'hidden_tags'
12 CONTEXT_HIDDEN_TAGS = 'hidden_tags'
13
13
14 TEMPLATE = 'boards/settings.html'
15
14
16
15 class SettingsView(BaseBoardView):
17 class SettingsView(BaseBoardView):
16
18
17 def get(self, request):
19 def get(self, request):
18 params = self.get_context_data()
20 params = dict()
19 settings_manager = get_settings_manager(request)
21 settings_manager = get_settings_manager(request)
20
22
21 selected_theme = settings_manager.get_theme()
23 selected_theme = settings_manager.get_theme()
@@ -29,8 +31,7 b' class SettingsView(BaseBoardView):'
29 params[CONTEXT_FORM] = form
31 params[CONTEXT_FORM] = form
30 params[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
32 params[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
31
33
32 # TODO Use dict here
34 return render(request, TEMPLATE, params)
33 return render(request, 'boards/settings.html', params)
34
35
35 def post(self, request):
36 def post(self, request):
36 settings_manager = get_settings_manager(request)
37 settings_manager = get_settings_manager(request)
@@ -46,5 +47,13 b' class SettingsView(BaseBoardView):'
46
47
47 settings_manager.set_setting(SETTING_USERNAME, username)
48 settings_manager.set_setting(SETTING_USERNAME, username)
48 settings_manager.set_setting(SETTING_LAST_NOTIFICATION_ID, None)
49 settings_manager.set_setting(SETTING_LAST_NOTIFICATION_ID, None)
50
51 return redirect('settings')
52 else:
53 params = dict()
49
54
50 return redirect('settings')
55 params[CONTEXT_FORM] = form
56 params[CONTEXT_HIDDEN_TAGS] = settings_manager.get_hidden_tags()
57
58 return render(request, TEMPLATE, params)
59
General Comments 0
You need to be logged in to leave comments. Login now