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:
2018-03-26 12:51:51 +02:00
parent 905643cbff
commit 874271a87c
4 changed files with 119 additions and 17 deletions

18
helpers.php Normal file
View 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;
}
?>