mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Bugfix: Consolidate user->email & user->emailAddress.
Also add an auto-migrator on login. Fixes #167
This commit is contained in:
parent
f3d797695e
commit
4e801c4692
3 changed files with 12 additions and 4 deletions
|
@ -8,7 +8,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
### Fixed
|
||||
- Fixed double-escaping of rendered HTML when nesting templates
|
||||
- Squashed a warning if the search index doesn't exist yet
|
||||
- Fixed the stats updater if no pages in the system have tags yet
|
||||
- Fixed a crash in the stats updater if no pages in the system have tags yet
|
||||
- Consolidated `email` and `emailAddress` fields into the latter in the user table (#167)
|
||||
|
||||
### Added
|
||||
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.
|
||||
|
|
|
@ -44,8 +44,8 @@ register_module([
|
|||
foreach($settings->users as $username => $user_data) {
|
||||
$content .= "<tr>";
|
||||
$content .= "<td>" . page_renderer::render_username($username) . "</td>";
|
||||
if(!empty($user_data->email))
|
||||
$content .= "<td><a href='mailto:" . htmlentities($user_data->email, ENT_HTML5 | ENT_QUOTES) . "'>" . htmlentities($user_data->email) . "</a></td>\n";
|
||||
if(!empty($user_data->emailAddress))
|
||||
$content .= "<td><a href='mailto:" . htmlentities($user_data->emailAddress, ENT_HTML5 | ENT_QUOTES) . "'>" . htmlentities($user_data->emailAddress) . "</a></td>\n";
|
||||
else
|
||||
$content .= "<td><em>(None provided)</em></td>\n";
|
||||
$content .= "<td>";
|
||||
|
@ -119,7 +119,7 @@ register_module([
|
|||
$user_data = new stdClass();
|
||||
$user_data->password = hash_password($new_password);
|
||||
if(!empty($new_email))
|
||||
$user_data->email = $new_email;
|
||||
$user_data->emailAddress = $new_email;
|
||||
|
||||
$settings->users->$new_username = $user_data;
|
||||
|
||||
|
|
|
@ -114,6 +114,13 @@ register_module([
|
|||
error_log("[Pepperminty Wiki] Updated password hash for $user.");
|
||||
}
|
||||
|
||||
// If the email address is still in the old field, migrate it
|
||||
if(!empty($settings->users->{$user}->email)) {
|
||||
$settings->users->{$user}->emailAddress = $settings->users->{$user}->email;
|
||||
unset($settings->users->{$user}->email);
|
||||
save_settings();
|
||||
}
|
||||
|
||||
$_SESSION["$settings->sessionprefix-user"] = $user;
|
||||
$_SESSION["$settings->sessionprefix-pass"] = $new_password_hash ?? hash_password($pass);
|
||||
$_SESSION["$settings->sessionprefix-expiretime"] = time() + 60*60*24*30; // 30 days from now
|
||||
|
|
Loading…
Reference in a new issue