Skip to content

Commit

Permalink
MDL-11451 adding default ipaddress restriction and 7 days lifetime fo…
Browse files Browse the repository at this point in the history
…r user key
  • Loading branch information
skodak committed Sep 27, 2007
1 parent d0cbeaf commit 662a057
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions grade/export/grade_export_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ function definition() {
$mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80));
$mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'),
false, true, false, get_string("keyiprestrictionhelp", 'userkey')));
$mform->setDefault('iprestriction', getremoteaddr()); // own IP - just in case somebody does not know what user key is

$mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true));
$mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'),
false, true, false, get_string("keyvaliduntilhelp", 'userkey')));
$mform->setDefault('validuntil', time()+3600*24*7); // only 1 week default duration - just in case somebody does not know what user key is

$mform->disabledIf('iprestriction', 'key', 'noteq', 1);
$mform->disabledIf('validuntil', 'key', 'noteq', 1);
}
Expand Down
2 changes: 2 additions & 0 deletions grade/import/xml/grade_import_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ function definition () {
$mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80));
$mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'),
false, true, false, get_string("keyiprestrictionhelp", 'userkey')));
$mform->setDefault('iprestriction', getremoteaddr()); // own IP - just in case somebody does not know what user key is

$mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true));
$mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'),
false, true, false, get_string("keyvaliduntilhelp", 'userkey')));
$mform->setDefault('validuntil', time()+3600*24*7); // only 1 week default duration - just in case somebody does not know what user key is

$mform->disabledIf('iprestriction', 'key', 'noteq', 1);
$mform->disabledIf('validuntil', 'key', 'noteq', 1);
Expand Down

0 comments on commit 662a057

Please sign in to comment.