first version of change_password interceptor (more see details)
- add stripLocalpart in helpers.php - extend mxDatabase to update the password once validated
This commit is contained in:
18
helpers.php
Normal file
18
helpers.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function stripLocalpart($mxid) {
|
||||
$localpart = NULL;
|
||||
if (!empty($mxid)) {
|
||||
// A mxid would start with an @ so we start at the 2. position
|
||||
$sepPos = strpos($mxid,':', 1);
|
||||
if ($sepPos === false) {
|
||||
// : not found. Assume mxid is localpart
|
||||
// TODO: further checks
|
||||
$localpart = $mxid;
|
||||
} else {
|
||||
$localpart = substr($mxid, 1, strpos($mxid,':') - 1 );
|
||||
}
|
||||
}
|
||||
return $localpart;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user