X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/c5afbbfa035748352cae8ab92b779368cb92b4b3..d6bf8fa992cc01adc311b2ba80f29d7af466c2f3:/login/mailpass.inc.php diff --git a/login/mailpass.inc.php b/login/mailpass.inc.php index 1be0d68..2b0c204 100644 --- a/login/mailpass.inc.php +++ b/login/mailpass.inc.php @@ -14,15 +14,17 @@ function mailtoken($email) { $found = userbymail($email); if (!$found) return FALSE; + $user = new User("profile/$found"); + if (empty($user)) return FALSE; $token = substr(sha1('$Random'.rand()), 0, 10); if (!file_put_contents("profile/$found/.token", $token)) throw new Exception("could not store token for $found"); - $sitename = $_SERVER['HTTP_HOST']; + $sitename = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); $sitelink = 'https://'.$sitename; $rep = [ - '[[user]]' => $found, + '[[user]]' => $user->name ?: $found, '[[link]]' => "$sitelink/login/pass?token=$found:$token", '[[site]]' => $sitename, ];