mirror of
https://github.com/humhub/humhub.git
synced 2025-04-22 08:03:35 +02:00
Save current language for email invitation and show language chooser on registration form (#7381)
Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
e31c77d603
commit
056e0d4654
@ -4,6 +4,7 @@ HumHub Changelog
|
||||
1.17.1 (Unreleased)
|
||||
-------------------
|
||||
- Fix #7377: Configured Redis cache key prefix was overwritten by the default value
|
||||
- Fix #7375: Use default language for email invitation and show language chooser on registration form
|
||||
- Enh #7383: Improve SelfTest for Base URL
|
||||
|
||||
1.17.0 (January 13, 2025)
|
||||
|
@ -88,6 +88,7 @@ class InviteController extends Controller
|
||||
$userInvite->email = $email;
|
||||
$userInvite->source = Invite::SOURCE_INVITE;
|
||||
$userInvite->user_originator_id = Yii::$app->user->getIdentity()->id;
|
||||
$userInvite->language = Yii::$app->settings->get('defaultLanguage');
|
||||
|
||||
$existingInvite = Invite::findOne(['email' => $email]);
|
||||
if ($existingInvite !== null) {
|
||||
|
@ -52,7 +52,9 @@ final class InviteRegistrationService
|
||||
{
|
||||
$invite = $this->getInvite();
|
||||
if ($invite !== null) {
|
||||
Yii::$app->setLanguage($invite->language);
|
||||
if (Yii::$app->request->post('ChooseLanguage') === null) {
|
||||
Yii::$app->setLanguage($invite->language);
|
||||
}
|
||||
$registration->getUser()->email = $invite->email;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ use humhub\libs\Html;
|
||||
use humhub\modules\ui\form\widgets\ActiveForm;
|
||||
use humhub\modules\user\models\forms\Registration;
|
||||
use humhub\modules\user\widgets\AuthChoice;
|
||||
use humhub\widgets\LanguageChooser;
|
||||
use humhub\widgets\SiteLogo;
|
||||
|
||||
/**
|
||||
@ -32,12 +33,15 @@ $this->pageTitle = Yii::t('UserModule.auth', 'Create Account');
|
||||
|
||||
<?php if ($showRegistrationForm): ?>
|
||||
<?php $form = ActiveForm::begin(['id' => 'registration-form', 'enableClientValidation' => false]); ?>
|
||||
<?= Html::hiddenInput('ChooseLanguage[language]', Yii::$app->language) ?>
|
||||
<?= $hForm->render($form); ?>
|
||||
<?php ActiveForm::end(); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= LanguageChooser::widget() ?>
|
||||
</div>
|
||||
|
||||
<script <?= Html::nonce() ?>>
|
||||
|
Loading…
x
Reference in New Issue
Block a user