comparison src/plugins/plugin_misc_account.py @ 1713:0d972af37ff5

plugin misc_account: temporary disabling posts and account deletion
author souliane <souliane@mailoo.org>
date Wed, 02 Dec 2015 09:10:58 +0100
parents 94c450972346
children c1be6363bfab
comparison
equal deleted inserted replaced
1712:96b722a5e263 1713:0d972af37ff5
302 form_ui.addLabel(D_("New password")) 302 form_ui.addLabel(D_("New password"))
303 form_ui.addPassword("new_passwd1", value="") 303 form_ui.addPassword("new_passwd1", value="")
304 form_ui.addLabel(D_("New password (again)")) 304 form_ui.addLabel(D_("New password (again)"))
305 form_ui.addPassword("new_passwd2", value="") 305 form_ui.addPassword("new_passwd2", value="")
306 306
307 # FIXME: uncomment and fix these features
308 """
307 if 'GROUPBLOG' in self.host.plugins: 309 if 'GROUPBLOG' in self.host.plugins:
308 tab_container.addTab("delete_posts", D_("Delete your posts"), container=xml_tools.PairsContainer) 310 tab_container.addTab("delete_posts", D_("Delete your posts"), container=xml_tools.PairsContainer)
309 form_ui.addLabel(D_("Current profile password")) 311 form_ui.addLabel(D_("Current profile password"))
310 form_ui.addPassword("delete_posts_passwd", value="") 312 form_ui.addPassword("delete_posts_passwd", value="")
311 form_ui.addLabel(D_("Delete all your posts and their comments")) 313 form_ui.addLabel(D_("Delete all your posts and their comments"))
316 tab_container.addTab("delete", D_("Delete your account"), container=xml_tools.PairsContainer) 318 tab_container.addTab("delete", D_("Delete your account"), container=xml_tools.PairsContainer)
317 form_ui.addLabel(D_("Current profile password")) 319 form_ui.addLabel(D_("Current profile password"))
318 form_ui.addPassword("delete_passwd", value="") 320 form_ui.addPassword("delete_passwd", value="")
319 form_ui.addLabel(D_("Delete your account")) 321 form_ui.addLabel(D_("Delete your account"))
320 form_ui.addBool("delete_checkbox", "false") 322 form_ui.addBool("delete_checkbox", "false")
323 """
324
321 return form_ui.toXml() 325 return form_ui.toXml()
322 326
323 @defer.inlineCallbacks 327 @defer.inlineCallbacks
324 def _accountDialogCb(self, data, profile): 328 def _accountDialogCb(self, data, profile):
325 """Called when the user submits the main account dialog 329 """Called when the user submits the main account dialog
339 error_ui = xml_tools.XMLUI("popup", title=D_("Attempt failure")) 343 error_ui = xml_tools.XMLUI("popup", title=D_("Attempt failure"))
340 error_ui.addText(message) 344 error_ui.addText(message)
341 return {'xmlui': error_ui.toXml()} 345 return {'xmlui': error_ui.toXml()}
342 346
343 # check for account deletion 347 # check for account deletion
348 # FIXME: uncomment and fix these features
349 """
344 delete_passwd = data[xml_tools.SAT_FORM_PREFIX + 'delete_passwd'] 350 delete_passwd = data[xml_tools.SAT_FORM_PREFIX + 'delete_passwd']
345 delete_checkbox = data[xml_tools.SAT_FORM_PREFIX + 'delete_checkbox'] 351 delete_checkbox = data[xml_tools.SAT_FORM_PREFIX + 'delete_checkbox']
346 if delete_checkbox == 'true': 352 if delete_checkbox == 'true':
347 verified = yield verify(delete_passwd) 353 verified = yield verify(delete_passwd)
348 assert isinstance(verified, bool) 354 assert isinstance(verified, bool)
361 verified = yield verify(delete_posts_passwd) 367 verified = yield verify(delete_posts_passwd)
362 assert isinstance(verified, bool) 368 assert isinstance(verified, bool)
363 if verified: 369 if verified:
364 defer.returnValue(self.__deleteBlogPosts(posts, comments, profile)) 370 defer.returnValue(self.__deleteBlogPosts(posts, comments, profile))
365 defer.returnValue(error_ui()) 371 defer.returnValue(error_ui())
372 """
366 373
367 # check for password modification 374 # check for password modification
368 current_passwd = data[xml_tools.SAT_FORM_PREFIX + 'current_passwd'] 375 current_passwd = data[xml_tools.SAT_FORM_PREFIX + 'current_passwd']
369 new_passwd1 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd1'] 376 new_passwd1 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd1']
370 new_passwd2 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd2'] 377 new_passwd2 = data[xml_tools.SAT_FORM_PREFIX + 'new_passwd2']