61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
*
|
|
* @file
|
|
* @author Bennet Bleßmann
|
|
* @author Einhard Leichtfuß
|
|
* @copyright © 2020 Bennet Bleßmann, Einhard Leichtfuß
|
|
* @license GNU General Public Licence 2.0 or later
|
|
*/
|
|
|
|
/*
|
|
* The roomNumber must not clash with the uidNumber on the IfI LDAP directory.
|
|
* Also, it must be strictly below 2^31 - 10^9 for Mumble.
|
|
* Note: The above is only indirectly verfied, due to the stu-number being
|
|
* restricted to 9 digits in 'SpecialStudiRegistration.
|
|
* (10^9 < 2^30 < 2^31 - 10^9)
|
|
*/
|
|
define('ROOM_NUMBER_OFFSET', 2**29);
|
|
|
|
define('LDAP_TOKEN_ATTR', 'destinationIndicator');
|
|
define('LDAP_TIMESTAMP_ATTR', 'description');
|
|
define('LDAP_ML_REQ_ATTR', 'carLicense');
|
|
|
|
define('TOKEN_BYTES', 32);
|
|
define('TOKEN_HEX_LEN', TOKEN_BYTES * 2);
|
|
define('TOKEN_HASH_ALGO', 'sha512');
|
|
define('TOKEN_EXPIRY_MINUTES', 10);
|
|
define('TOKEN_EXPIRY_SECONDS', TOKEN_EXPIRY_MINUTES * 60);
|
|
|
|
/*
|
|
* The maximum number of stu digits is dictated by its use as offset for the
|
|
* roomNumber. See StudiRegistration.php:ROOM_NUMBER_OFFSET for more details.
|
|
*/
|
|
define('MAX_STU_DIGITS', 9);
|
|
define('STU_NAME_PREFIX', 'stu');
|
|
define('ACC_PREFIX', 'fs-');
|
|
define('MAX_STU_LEN', strlen(STU_NAME_PREFIX) + MAX_STU_DIGITS);
|
|
|
|
// Password length is calculated as Unicode length (using mb_strlen()).
|
|
define('MIN_PW_LEN', 12);
|
|
define('MAX_PW_LEN', 512);
|
|
|
|
define('MAIL_LINE_LEN', 72);
|
|
|
|
define('BASE_URL', 'https://www.fs-infmath.uni-kiel.de/wiki');
|
|
define('SELF_URL', BASE_URL . '/Spezial:StudiRegistration');
|
|
|
|
define('MAIL_SUFFIX', '@mail.uni-kiel.de');
|
|
|
|
|
|
class StudiRegistrationCommon {
|
|
static function validate_stu_name($stu_name)
|
|
{
|
|
return (strlen($stu_name) <= MAX_STU_LEN)
|
|
&& preg_match('/^' . STU_NAME_PREFIX . '\d+$/', $stu_name);
|
|
}
|
|
}
|
|
|
|
# vi: tw=80 fo+=t ts=8 sts=0 et sw=4 sta ai
|
|
?>
|