[v1.17] Remove uisetting include captcha in registration new updated (#7086)

* #173 Fix for issue Remove UISetting "Include Captcha in Registration"

* Rewording

---------

Co-authored-by: ultimocoder <=Ultimoresq@gmail.com>
Co-authored-by: Marc Farré <contact@marc.fun>
Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
Ultimo 2024-10-20 18:33:44 +05:30 committed by GitHub
parent 7f13a3d2f1
commit 79e1b2dbf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 59 additions and 23 deletions

View File

@ -54,6 +54,7 @@ HumHub Changelog
- Enh #7257: Move "About" into Space Control Menu
- Enh #7262: Disable `Like` on archived content
- Enh #7125: Prerequisites - Check test for pending migrations
- Fix #173 : Remove UISetting "Include Captcha in Registr
1.16.3 (Unreleased)
--------------------------

View File

@ -10,24 +10,20 @@ Version 1.17 (Unreleased)
- Forms in modal box no longer have focus automatically on the first field. [The `autofocus` attribute](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autofocus) is now required on the field. More info: [#7136](https://github.com/humhub/humhub/issues/7136)
#### Removed
- Removed obsolete property `humhub\modules\content\widgets\richtext\AbstractRichText::$record`
- Removed `\humhub\widgets\ShowMorePager` widget
Version 1.17 (Unreleased)
-------------------------
### New
- CSS variables: `--hh-fixed-header-height` and `--hh-fixed-footer-height` (see [#7131](https://github.com/humhub/humhub/issues/7131)): these variables should be added to custom themes in the `variables.less` file to overwrite the fixed header (e.g. the top menu + margins) and footer heights with the ones of the custom theme.
- `\humhub\modules\user\Module::enableRegistrationFormCaptcha` which is true by default (can be disabled via [file configuration](https://docs.humhub.org/docs/admin/advanced-configuration#module-configurations))
### Removed
- `Include captcha in registration form` checkbox removed from "Administration" -> "Users" -> "Settings"
- Removed obsolete property `humhub\modules\content\widgets\richtext\AbstractRichText::$record`
- Removed `\humhub\widgets\ShowMorePager` widget
Version 1.16 (April 2024)
-------------------------
At least PHP 8.0 is required with this version.
#### Removed
### Removed
- `\humhub\modules\search\*` The existing search module was removed and the related features merged into the 'content', 'user' and 'space' modules.
- `\humhub\modules\user\models\User::getSearchAttributes()` and `\humhub\modules\space\models\Space::getSearchAttributes()`

View File

@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
/**
* Class m240622_082606_fix_captcha_in_registration
*/
class m240622_082606_fix_captcha_in_registration extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->delete('setting', ['name' => 'auth.showCaptureInRegisterForm']);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m240622_082606_fix_captcha_in_registration cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m240622_082606_fix_captcha_in_registration cannot be reverted.\n";
return false;
}
*/
}

View File

@ -30,7 +30,6 @@ class AuthenticationSettingsForm extends Model
public $hideOnlineStatus;
public $defaultUserIdleTimeoutSec;
public $allowGuestAccess;
public $showCaptureInRegisterForm;
public $defaultUserProfileVisibility;
public $registrationSendMessageMailContent;
public $registrationApprovalMailContent;
@ -56,7 +55,6 @@ class AuthenticationSettingsForm extends Model
$this->hideOnlineStatus = $settingsManager->get('auth.hideOnlineStatus');
$this->defaultUserIdleTimeoutSec = $settingsManager->get('auth.defaultUserIdleTimeoutSec');
$this->allowGuestAccess = $settingsManager->get('auth.allowGuestAccess');
$this->showCaptureInRegisterForm = $settingsManager->get('auth.showCaptureInRegisterForm');
$this->defaultUserProfileVisibility = $settingsManager->get('auth.defaultUserProfileVisibility');
$this->registrationSendMessageMailContent = $settingsManager->get('auth.registrationSendMessageMailContent', ApproveUserForm::getDefaultSendMessageMailContent());
$this->registrationApprovalMailContent = $settingsManager->get('auth.registrationApprovalMailContent', ApproveUserForm::getDefaultApprovalMessage());
@ -69,7 +67,7 @@ class AuthenticationSettingsForm extends Model
public function rules()
{
return [
[['internalUsersCanInviteByEmail', 'internalUsersCanInviteByLink', 'internalAllowAnonymousRegistration', 'internalRequireApprovalAfterRegistration', 'allowGuestAccess', 'showCaptureInRegisterForm', 'showRegistrationUserGroup', 'blockUsers', 'hideOnlineStatus'], 'boolean'],
[['internalUsersCanInviteByEmail', 'internalUsersCanInviteByLink', 'internalAllowAnonymousRegistration', 'internalRequireApprovalAfterRegistration', 'allowGuestAccess', 'showRegistrationUserGroup', 'blockUsers', 'hideOnlineStatus'], 'boolean'],
['defaultUserProfileVisibility', 'in', 'range' => array_keys(User::getVisibilityOptions(false))],
['defaultUserIdleTimeoutSec', 'integer', 'min' => 20],
[['registrationSendMessageMailContent', 'registrationApprovalMailContent', 'registrationDenialMailContent'], 'string'],
@ -91,7 +89,6 @@ class AuthenticationSettingsForm extends Model
'hideOnlineStatus' => Yii::t('AdminModule.user', 'Hide online status of users'),
'defaultUserIdleTimeoutSec' => Yii::t('AdminModule.user', 'Default user idle timeout, auto-logout (in seconds, optional)'),
'allowGuestAccess' => Yii::t('AdminModule.user', 'Allow visitors limited access to content without an account (Adds visibility: "Guest")'),
'showCaptureInRegisterForm' => Yii::t('AdminModule.user', 'Include captcha in registration form'),
'defaultUserProfileVisibility' => Yii::t('AdminModule.user', 'Default user profile visibility'),
'registrationSendMessageMailContent' => Yii::t('AdminModule.user', 'Default content of the email when sending a message to the user'),
'registrationApprovalMailContent' => Yii::t('AdminModule.user', 'Default content of the registration approval email'),
@ -134,10 +131,6 @@ class AuthenticationSettingsForm extends Model
$settingsManager->set('auth.defaultUserProfileVisibility', $this->defaultUserProfileVisibility);
}
if ($settingsManager->get('auth.anonymousRegistration')) {
$settingsManager->set('auth.showCaptureInRegisterForm', $this->showCaptureInRegisterForm);
}
if ($settingsManager->get('auth.needApproval')) {
if (empty($this->registrationSendMessageMailContent) || $this->registrationSendMessageMailContent === ApproveUserForm::getDefaultSendMessageMailContent()) {
$this->registrationSendMessageMailContent = ApproveUserForm::getDefaultSendMessageMailContent();

View File

@ -25,8 +25,6 @@ $userModule = Yii::$app->getModule('user');
<?= $form->field($model, 'internalAllowAnonymousRegistration')->checkbox(); ?>
<?= $form->field($model, 'showCaptureInRegisterForm')->checkbox(); ?>
<?= $form->field($model, 'internalUsersCanInviteByEmail')->checkbox(); ?>
<?= $form->field($model, 'internalUsersCanInviteByLink')->checkbox(); ?>

View File

@ -50,7 +50,6 @@ class InitialData
Yii::$app->getModule('user')->settings->set('auth.anonymousRegistration', '1');
Yii::$app->getModule('user')->settings->set('auth.internalUsersCanInviteByEmail', '1');
Yii::$app->getModule('user')->settings->set('auth.internalUsersCanInviteByLink', '1');
Yii::$app->getModule('user')->settings->set('auth.showCaptureInRegisterForm', '1');
// Mailing
Yii::$app->settings->set('mailer.transportType', 'php');

View File

@ -192,6 +192,12 @@ class Module extends \humhub\components\Module
*/
public $allowUserRegistrationFromAuthClientIds = [];
/**
* @var bool Include captcha in registration form
* @since 1.17
*/
public $enableRegistrationFormCaptcha = true;
/**
* @var int Time to live in days for invites.
* Invites older than this number of days will be automatically deleted.

View File

@ -320,7 +320,7 @@ class Invite extends ActiveRecord
{
return
!$this->skipCaptchaValidation
&& (Yii::$app->getModule('user')->settings->get('auth.showCaptureInRegisterForm'));
&& (Yii::$app->getModule('user')->enableRegistrationFormCaptcha);
}
public function getCreatedBy()

View File

@ -31,6 +31,7 @@ return [
'modules' => [
'user' => [
'loginRememberMeDefault' => false,
'enableRegistrationFormCaptcha' => false,
],
'web' => [
'security' => [