Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWCS committed Mar 24, 2024
1 parent 77fa913 commit 3aa91df
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 50 deletions.
10 changes: 10 additions & 0 deletions docs/version_check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"stable": {
"3.3": {
"current": "1.0.0",
"announcement": "https://github.com/LukeWCS/force-account-reactivation/releases",
"eol": null,
"security": false
}
}
}
9 changes: 9 additions & 0 deletions force-account-reactivation_build_changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 1.0.0
* Release (2024-03-24)
* ACP-Template:
* Im Pulldown der Excludes werden Systemgruppen jetzt fett dargestellt, wie bei phpBB.
* `select()` Makro für die Fett-Darstellung erweitert.
* `text()` Makro entfernt, wurde nur in der Alpha benötigt.
* Sprachdateien:
* Texte präzisiert.

#### 1.0.0-b3
* Benutzerverwaltung:
* In der Übersicht wird bei einem Benutzer jetzt auch das Datum der letzten Passwort-Änderung angezeigt.
Expand Down
2 changes: 1 addition & 1 deletion force-account-reactivation_changelog_de.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### 1.0.0
(--)
(2024-03-24)

* Erste offizielle Version.

14 changes: 4 additions & 10 deletions lukewcs/forcereactivation/adm/style/acp_foraccrea_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,16 @@ <h1>{{ lang('FORACCREA_CONFIG_TITLE') }}</h1>
}}>
{%- endmacro %}

{% macro text(name, value, size = null, placeholder = null, pattern = null, title = null) -%}
<input type="text" name="{{ name }}" value="{{ value }}"{{
(size !== null ? ' size="' ~ size ~ '"') ~
(placeholder !== null ? ' placeholder="' ~ placeholder ~ '"') ~
(pattern !== null ? ' pattern="' ~ pattern ~ '"') ~
(title !== null ? ' title="' ~ title ~ '"')
}}>
{%- endmacro %}

{% macro select(name, options, multiple = null, size = null) -%}
<select name="{{ name }}{{ multiple ? '[]' }}"{{
(multiple !== null ? ' multiple') ~
(size !== null ? ' size="' ~ size ~ '"')
}}>
{% for opt in options %}
<option value="{{ opt.value }}"{{ opt.selected ? ' selected' }}>{{ lang(opt.label) }}</option>
<option value="{{ opt.value }}"{{
((opt.bold ?? false) !== false ? ' class="sep"') ~
(opt.selected ? ' selected')
}}>{{ lang(opt.label) }}</option>
{% endfor %}
</select>
{%- endmacro %}
Expand Down
10 changes: 8 additions & 2 deletions lukewcs/forcereactivation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "Allows you to force an automatic user account reactivation if it has been too long since the user last logged in.",
"homepage": "https://github.com/LukeWCS",
"version": "1.0.0-b3",
"time": "2024-03-20",
"version": "1.0.0",
"time": "2024-03-24",
"license": "GPL-2.0-only",
"authors": [
{
Expand All @@ -22,6 +22,12 @@
"lang-min-ver": "1.0.0",
"soft-require": {
"phpbb/phpbb": ">=3.3.0,<3.4.0@dev"
},
"version-check": {
"host": "lukewcs.github.io",
"directory": "/force-account-reactivation",
"filename": "version_check.json",
"ssl": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function module_settings(): void
'label' => $this->group_helper->get_name($group['group_name']),
'value' => $group['group_id'],
'selected' => in_array($group['group_id'], $exclude_group_ids),
'bold' => $group['group_type'] == GROUP_SPECIAL,
];
}

Expand Down
30 changes: 0 additions & 30 deletions lukewcs/forcereactivation/event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public static function getSubscribedEvents()
public function check_force_reactivation($event)
{
$user_row = $event['login']['user_row'];
// $test_users = ['force_react_user', 'test2'];

// Check requirements
if ($event['login']['status'] != LOGIN_SUCCESS
Expand All @@ -69,14 +68,9 @@ public function check_force_reactivation($event)
|| $user_row['user_email'] == ''
)
{
// if (array_search($user_row['username_clean'], $test_users) !== false)
// {
// trigger_error('requirements false');
// }
// Requirements not met, cancel process.
return;
}
// var_dump($user_row['username_clean']);

// Determine the user's last visit.
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
Expand All @@ -86,8 +80,6 @@ public function check_force_reactivation($event)
$user_last_session = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$user_lastvisit = $user_last_session['session_time'] ?? $user_row['user_lastvisit'] ?? 1;
// var_dump('user_last_session', $user_last_session);
// var_dump('user_last_time', $user_lastvisit);

// Determine the ID of the NRU group.
$sql = 'SELECT group_id, group_type, group_name
Expand All @@ -97,12 +89,10 @@ public function check_force_reactivation($event)
$fetchrow = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$nru_group_id = $fetchrow['group_id'] ?? null;
// var_dump('nru_group_id', $nru_group_id);

// Check whether the user is excluded.
$group_memberships = group_memberships(false, $user_row['user_id']);
$user_group_ids = array_column($group_memberships, 'group_id');
// var_dump('is nru', array_search($nru_group_id, $user_group_ids) !== false);

if ($nru_group_id !== null && array_search($nru_group_id, $user_group_ids) !== false)
{
Expand All @@ -115,27 +105,11 @@ public function check_force_reactivation($event)
$exclude_user = count($intersect_group_ids) > 0;
}

// var_dump('exclude_group_ids', $exclude_group_ids ?? null);
// var_dump('user_group_ids', $user_group_ids);
// var_dump('intersect_group_ids', $intersect_group_ids ?? null);
// var_dump('exclude_user', $exclude_user == true);

// var_dump($user_row['user_lastvisit']);
// var_dump($user_row['user_lastvisit'] - strtotime('-' . $this->config['foraccrea_time_range'] . ' ' . $this->config['foraccrea_time_range_type']));
// var_dump($event['login']['status']);
// var_dump($event['login']['user_row']);
// var_dump($user_row['user_type']);

// Check conditions for forced reactivation
if ($exclude_user
|| $user_lastvisit >= strtotime(' - ' . $this->config['foraccrea_time_range'] . ' ' . $this->config['foraccrea_time_range_type'])
// || $user_row['username_clean'] != 'force_react_user'
)
{
// if (array_search($user_row['username_clean'], $test_users) !== false)
// {
// trigger_error('allowed');
// }
// We don't have to act, user is allowed to pass.
return;
}
Expand Down Expand Up @@ -181,10 +155,6 @@ public function check_force_reactivation($event)
'reportee_id' => $user_row['user_id']
]);

// 1707596986
// http://phpbb33/ucp.php?mode=activate&u=72&k=
// echo "<a href='{$server_url}/ucp.{$this->php_ext}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}'>activate</a>";

// Show the user a message and explain how they can reactivate their account.
trigger_error($this->language->lang('FORACCREA_MSG_REACTIVATION_EXPLANATION'));
}
Expand Down
2 changes: 1 addition & 1 deletion lukewcs/forcereactivation/language/de/acp_foraccrea.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

'FORACCREA_SETTINGS_TITLE' => 'Einstellungen',
'FORACCREA_ENABLE' => 'Funktion aktivieren',
'FORACCREA_ENABLE_EXPLAIN' => 'Mit diesem Schalter kannst du die Funktionalität dieser Erweiterung deaktivieren, ohne die Erweiterung komplett deaktivieren zu müssen.',
'FORACCREA_ENABLE_EXPLAIN' => 'Mit diesem Schalter kannst du die erzwungene Konto-Reaktivierung deaktivieren, ohne die Erweiterung komplett deaktivieren zu müssen.',
'FORACCREA_TIME_RANGE' => 'Gültiger Zeitraum',
'FORACCREA_TIME_RANGE_EXPLAIN' => 'Hier kannst du festlegen, wie lange die letzte Anmeldung eines Benutzerkontos maximal her sein darf, bevor eine Reaktivierung erzwungen wird.',
'FORACCREA_TIME_RANGE_YEARS' => 'Jahre',
Expand Down
2 changes: 1 addition & 1 deletion lukewcs/forcereactivation/language/de/foraccrea_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
// ’ « » “ ” … „ “

$lang = array_merge($lang, [
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'Du hast dich in diesem Forum eine längere Zeit nicht mehr angemeldet, deshalb wurde dein Benutzerkonto aus Sicherheitsgründen vorübergehend deaktiviert.<br><br>Es wurde ein Link für die Reaktivierung an die E-Mail Adresse geschickt, die im Benutzerkonto hinterlegt ist. Sobald du diesen Link aufgerufen hast, wird dein Benutzerkonto reaktiviert und du kannst dich wieder hier im Forum anmelden.',
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'Du hast dich in diesem Forum eine längere Zeit nicht mehr angemeldet, deshalb wurde dein Benutzerkonto aus Sicherheitsgründen vorübergehend deaktiviert.<br><br>Es wurde soeben ein Link für die Reaktivierung an die E-Mail Adresse geschickt, die im Benutzerkonto hinterlegt ist. Sobald du diesen Link aufgerufen hast, wird dein Benutzerkonto reaktiviert und du kannst dich wieder hier im Forum anmelden.',
]);
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

'FORACCREA_SETTINGS_TITLE' => 'Einstellungen',
'FORACCREA_ENABLE' => 'Funktion aktivieren',
'FORACCREA_ENABLE_EXPLAIN' => 'Mit diesem Schalter können Sie die Funktionalität dieser Erweiterung deaktivieren, ohne die Erweiterung komplett deaktivieren zu müssen.',
'FORACCREA_ENABLE_EXPLAIN' => 'Mit diesem Schalter können Sie die erzwungene Konto-Reaktivierung deaktivieren, ohne die Erweiterung komplett deaktivieren zu müssen.',
'FORACCREA_TIME_RANGE' => 'Gültiger Zeitraum',
'FORACCREA_TIME_RANGE_EXPLAIN' => 'Hier können Sie festlegen, wie lange die letzte Anmeldung eines Benutzerkontos maximal her sein darf, bevor eine Reaktivierung erzwungen wird.',
'FORACCREA_TIME_RANGE_YEARS' => 'Jahre',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
// ’ « » “ ” … „ “

$lang = array_merge($lang, [
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'Sie haben sich in diesem Forum eine längere Zeit nicht mehr angemeldet, deshalb wurde Ihr Benutzerkonto aus Sicherheitsgründen vorübergehend deaktiviert.<br><br>Es wurde ein Link für die Reaktivierung an die E-Mail Adresse geschickt, die im Benutzerkonto hinterlegt ist. Sobald Sie diesen Link aufgerufen haben, wird Ihr Benutzerkonto reaktiviert und Sie können sich wieder hier im Forum anmelden.',
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'Sie haben sich in diesem Forum eine längere Zeit nicht mehr angemeldet, deshalb wurde Ihr Benutzerkonto aus Sicherheitsgründen vorübergehend deaktiviert.<br><br>Es wurde soeben ein Link für die Reaktivierung an die E-Mail Adresse geschickt, die im Benutzerkonto hinterlegt ist. Sobald Sie diesen Link aufgerufen haben, wird Ihr Benutzerkonto reaktiviert und Sie können sich wieder hier im Forum anmelden.',
]);
2 changes: 1 addition & 1 deletion lukewcs/forcereactivation/language/en/acp_foraccrea.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

'FORACCREA_SETTINGS_TITLE' => 'Settings',
'FORACCREA_ENABLE' => 'Enable function',
'FORACCREA_ENABLE_EXPLAIN' => 'This switch allows you to disable the functionality of this extension without having to disable the extension completely.',
'FORACCREA_ENABLE_EXPLAIN' => 'This switch allows you to disable forced account reactivation without having to disable the extension completely.',
'FORACCREA_TIME_RANGE' => 'Valid time period',
'FORACCREA_TIME_RANGE_EXPLAIN' => 'Here you can specify the maximum time ago that a user account was last logged in before reactivation is forced.',
'FORACCREA_TIME_RANGE_YEARS' => 'Years',
Expand Down
2 changes: 1 addition & 1 deletion lukewcs/forcereactivation/language/en/foraccrea_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
// ’ « » “ ” … „ “

$lang = array_merge($lang, [
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'You have not logged in to this forum for a long time, so your user account has been temporarily deactivated for security reasons.<br><br>A link for reactivation has been sent to the email address stored in the user account. As soon as you have accessed this link, your user account will be reactivated and you can log in to the forum again.',
'FORACCREA_MSG_REACTIVATION_EXPLANATION' => 'You have not logged in to this forum for a long time, so your user account has been temporarily deactivated for security reasons.<br><br>A link for reactivation has just been sent to the email address stored in the user account. As soon as you have accessed this link, your user account will be reactivated and you can log in to the forum again.',
]);
5 changes: 4 additions & 1 deletion lukewcs/forcereactivation/migrations/v_1_0_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* @copyright (c) 2024, LukeWCS, https://www.wcsaga.org/
* @license GNU General Public License, version 2 (GPL-2.0)
*
* Note: This extension is 100% genuine handcraft and consists of selected
* natural raw materials. There was no AI involved in making it.
*
*/

namespace lukewcs\forcereactivation\migrations;
Expand All @@ -23,7 +26,7 @@ public function update_data()
['config.add', ['foraccrea_enable' , 0]],
['config.add', ['foraccrea_time_range' , 2]],
['config.add', ['foraccrea_time_range_type' , 'years']],
['config.add', ['foraccrea_exclude_groups' , '']],
['config.add', ['foraccrea_exclude_groups' , '[]']],
['config.add', ['foraccrea_exclude_nru' , 0]],
['module.add', [
'acp',
Expand Down

0 comments on commit 3aa91df

Please sign in to comment.