Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
3b98ce30
Commit
3b98ce30
authored
Jun 27, 2011
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor script to allow create Credential Recoveries when question and answer are None.
parent
6996139b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_newCredentialRecovery.xml
..._skins/erp5_credential/ERP5Site_newCredentialRecovery.xml
+21
-13
bt5/erp5_credential/bt/revision
bt5/erp5_credential/bt/revision
+1
-1
No files found.
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/ERP5Site_newCredentialRecovery.xml
View file @
3b98ce30
...
...
@@ -55,11 +55,18 @@
Proxy : Manager proxy role is required to make possible for \n
anonymous to create a new Credential Recovery\n
\'\'\'\n
def createCredentialRecovery(**kw):\n
module = portal.getDefaultModule(portal_type=\'Credential Recovery\')\n
credential_recovery = module.newContent(\n
\t\tportal_type="Credential Recovery",\n
**kw)\n
credential_recovery.submit()\n
\n
portal = context.getPortalObject()\n
person_module = portal.getDefaultModule(\'Person\')\n
result = person_module.searchFolder(reference=reference)\n
if len(result) != 1:\n
portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to
update
your credentials.")\n
portal_status_message = portal.Base_translateString("Can\'t find corresponding person, it\'s not possible to
recovery
your credentials.")\n
return context.Base_redirect(\'\', keep_items = dict(portal_status_message=portal_status_message ))\n
\n
person = result[0].getObject()\n
...
...
@@ -67,22 +74,23 @@ person = result[0].getObject()\n
# Check the response\n
question_free_text = person.getDefaultCredentialQuestionQuestionFreeText()\n
question_title = person.getDefaultCredentialQuestionQuestionTitle()\n
question_answer = person.getDefaultCredentialQuestionAnswer().lower()\n
question_answer = person.getDefaultCredentialQuestionAnswer()\n
question_answer = question_answer and question_answer.lower()\n
answer = default_credential_question_answer and default_credential_question_answer.lower() or \'\'\n
\n
if (question_title or question_title) and (answer == question_answer):
\n
# create the credential recovery
\n
module = portal.getDefaultModule(portal_type=\'Credential Recovery\')
\n
credential_recovery = module.newContent(
\n
\t\tportal_type="Credential Recovery",
\n
reference=reference,\n
keep_items = {}
\n
message = "Credential Recovery Created."
\n
dialog_id = dialog_id or "login_form"
\n
\n
if question_title and (answer == question_answer):
\n
createCredentialRecovery(
reference=reference,\n
default_credential_question_answer=default_credential_question_answer,\n
destination_decision=person.getRelativeUrl(),\n
language=portal.Localizer.get_selected_language())\n
credential_recovery.submit()
\n
message = "Credential Recovery Created."
\n
keep_items = {}
\n
dialog_id = \'login_form\'
\n
elif question_free_text is None and question_answer is None:
\n
createCredentialRecovery(reference=reference,
\n
destination_decision=person.getRelativeUrl(),
\n
language=portal.Localizer.get_selected_language())
\n
else:\n
message = "You didn\'t enter the correct answer."\n
keep_items = {\'default_credential_question_question_free_text\': question_free_text,\n
...
...
@@ -90,7 +98,7 @@ else:\n
\'reference\': reference}\n
\n
keep_items[\'portal_status_message\'] = portal.Base_translateString(message)\n
return context.Base_redirect(dialog_id, keep_items
=
keep_items)\n
return context.Base_redirect(dialog_id, keep_items
=
keep_items)\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_credential/bt/revision
View file @
3b98ce30
353
\ No newline at end of file
354
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment