Author: jclarke
Date: 2010-07-19 12:15:15 +0200 (Mon, 19 Jul 2010)
New Revision: 93

Modified:
   self-service-password/trunk/config.inc.php
   self-service-password/trunk/index.php
   self-service-password/trunk/lang/en.inc.php
   self-service-password/trunk/pages/change.php
Log:
Add config switches for new features and add fallback to default action for 
nonexistant actions. Fixes #258.

Modified: self-service-password/trunk/config.inc.php
===================================================================
--- self-service-password/trunk/config.inc.php  2010-07-19 10:10:04 UTC (rev 92)
+++ self-service-password/trunk/config.inc.php  2010-07-19 10:15:15 UTC (rev 93)
@@ -82,12 +82,21 @@
 # manager: the above binddn
 $who_change_password = "user";
 
-# Questions/answers
+## Questions/answers
+# Use questions/answers?
+# true (default)
+# false
+$use_questions = true;
+
 # Answer attribute should be hidden to users!
 $answer_objectClass = "extensibleObject";
 $answer_attribute = "info";
 
-# Token
+## Token
+# Use tokens?
+# true (default)
+# false
+$use_tokens = true;
 $mail_attribute = "mail";
 
 # Display help messages

Modified: self-service-password/trunk/index.php
===================================================================
--- self-service-password/trunk/index.php       2010-07-19 10:10:04 UTC (rev 92)
+++ self-service-password/trunk/index.php       2010-07-19 10:15:15 UTC (rev 93)
@@ -45,8 +45,15 @@
 # Action (default: change password)
 #==============================================================================
 if (isset($_GET["action"]) and $_GET["action"]) { $action = $_GET["action"]; }
- else { $action = "change"; }
 
+# Available actions
+$available_actions = array( "change" );
+if ( $use_questions ) { array_push( $available_actions, "resetbyquestions", 
"setquestions"); }
+if ( $use_tokens ) { array_push( $available_actions, "resetbytoken", 
"sendtoken"); }
+
+# Ensure requested action is available, or fall back to default
+if ( ! in_array($action, $available_actions) ) { $action = "change"; }
+
 #==============================================================================
 ?>
 

Modified: self-service-password/trunk/lang/en.inc.php
===================================================================
--- self-service-password/trunk/lang/en.inc.php 2010-07-19 10:10:04 UTC (rev 92)
+++ self-service-password/trunk/lang/en.inc.php 2010-07-19 10:15:15 UTC (rev 93)
@@ -69,7 +69,8 @@
 $messages['answerchanged'] = "Your answer has been registered";
 $messages['answernomatch'] = "Your answer is not correct";
 $messages['resetbyquestionshelp'] = "Choose a question and answer it to reset 
your password. This requires to have already <a 
href=\"?action=setquestions\">register an answer</a>.";
-$messages['changehelp'] = "Enter your old password and choose a new one. If 
you forgot your old password, you can try to <a 
href=\"?action=resetbyquestions\">reset your password by answering 
questions</a>.";
+$messages['changehelp'] = "Enter your old password and choose a new one.";
+$messages['changehelpquestions'] = "If you forgot your old password, you can 
try to <a href=\"?action=resetbyquestions\">reset your password by answering 
questions</a>.";
 $messages['resetmessage'] = "Hello {login},\n\nClick here to reset your 
password:\n{url}\n\nIf your are not the issuer of this request, please ignore 
it.";
 $messages['resetsubject'] = "Reset your password";
 $messages['sendtokenhelp'] = "Enter your login and your password to reset your 
password. Then click on the link in sent mail.";

Modified: self-service-password/trunk/pages/change.php
===================================================================
--- self-service-password/trunk/pages/change.php        2010-07-19 10:10:04 UTC 
(rev 92)
+++ self-service-password/trunk/pages/change.php        2010-07-19 10:15:15 UTC 
(rev 93)
@@ -142,6 +142,9 @@
 if ( $show_help ) {
     echo "<div class=\"help\"><p>";
     echo $messages["changehelp"];
+    if ( $use_questions ) {
+        echo " " . $messages["changehelpquestions"];
+    }
     echo "</p></div>\n";
 }
 ?>

_______________________________________________
ltb-changes mailing list
[email protected]
http://lists.ltb-project.org/listinfo/ltb-changes

Reply via email to