Fix FLEXIAPI-330 Remove the ConfirmedRegistration email and related code

This commit is contained in:
Timothée Jaussoin 2025-06-17 10:51:38 +02:00
parent f20056ec73
commit 4f3e9c57c9
13 changed files with 23 additions and 108 deletions

View file

@ -48,6 +48,7 @@ v2.0
- Fix FLEXIAPI-325 Add endpoints to send the password reset and provisioning emails
- Fix FLEXIAPI-332 Check if the first line was untouched and that the number of columns is exact on each lines
- Fix FLEXIAPI-329 Use correct routes for accounts devices
- Fix FLEXIAPI-330 Remove the ConfirmedRegistration email and related code
v1.6
----

View file

@ -20,7 +20,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- INSTANCE_COPYRIGHT
- INSTANCE_INTRO_REGISTRATION
- INSTANCE_CUSTOM_THEME
- INSTANCE_CONFIRMED_REGISTRATION_TEXT
- WEB_PANEL
- PUBLIC_REGISTRATION
- PHONE_AUTHENTICATION

View file

@ -30,7 +30,6 @@ class ImportConfigurationFromDotEnv extends Command
$space->copyright_text = env('INSTANCE_COPYRIGHT', null);
$space->intro_registration_text = env('INSTANCE_INTRO_REGISTRATION', null);
$space->confirmed_registration_text = env('INSTANCE_CONFIRMED_REGISTRATION_TEXT', null);
$space->newsletter_registration_address = env('NEWSLETTER_REGISTRATION_ADDRESS', null);
$space->account_proxy_registrar_address = env('ACCOUNT_PROXY_REGISTRAR_ADDRESS', 'sip.domain.com');
$space->account_realm = env('ACCOUNT_REALM', null);

View file

@ -21,11 +21,8 @@ namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Log;
use App\Mail\ConfirmedRegistration;
class PasswordController extends Controller
{
public function show(Request $request)
@ -55,10 +52,6 @@ class PasswordController extends Controller
Log::channel('events')->info('Web: Password set for the first time', ['id' => $account->identifier]);
if (!empty($account->email)) {
Mail::to($account)->send(new ConfirmedRegistration($account));
}
return redirect()->route('account.dashboard');
}
}

View file

@ -162,7 +162,6 @@ class SpaceController extends Controller
$space->copyright_text = $request->get('copyright_text');
$space->intro_registration_text = $request->get('intro_registration_text');
$space->confirmed_registration_text = $request->get('confirmed_registration_text');
$space->newsletter_registration_address = $request->get('newsletter_registration_address');
$space->account_proxy_registrar_address = $request->get('account_proxy_registrar_address');

View file

@ -20,14 +20,11 @@
namespace App\Http\Controllers\Api\Account;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\Controller;
use App\Rules\PasswordAlgorithm;
use App\Mail\ConfirmedRegistration;
class PasswordController extends Controller
{
public function update(Request $request)
@ -63,9 +60,5 @@ class PasswordController extends Controller
}
$account->updatePassword($request->get('password'), $algorithm);
if (!empty($account->email)) {
Mail::to($account)->send(new ConfirmedRegistration($account));
}
}
}

View file

@ -66,7 +66,6 @@ class SpaceController extends Controller
$space->copyright_text = $request->get('copyright_text');
$space->intro_registration_text = $request->get('intro_registration_text');
$space->confirmed_registration_text = $request->get('confirmed_registration_text');
$space->newsletter_registration_address = $request->get('newsletter_registration_address');
$space->account_proxy_registrar_address = $request->get('account_proxy_registrar_address');
$space->account_realm = $request->get('account_realm');
@ -149,7 +148,6 @@ class SpaceController extends Controller
$space->copyright_text = $request->get('copyright_text');
$space->intro_registration_text = $request->get('intro_registration_text');
$space->confirmed_registration_text = $request->get('confirmed_registration_text');
$space->newsletter_registration_address = $request->get('newsletter_registration_address');
$space->account_proxy_registrar_address = $request->get('account_proxy_registrar_address');
$space->account_realm = $request->get('account_realm');

View file

@ -1,53 +0,0 @@
<?php
/*
Flexisip Account Manager is a set of tools to manage SIP accounts.
Copyright (C) 2025 Belledonne Communications SARL, All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace App\Mail;
use App\Account;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ConfirmedRegistration extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public Account $account
) {
}
public function envelope(): Envelope
{
return new Envelope(
subject: $this->account->space->name . ': '. __('Registration confirmed'),
);
}
public function content(): Content
{
return new Content(
markdown: 'mails.confirmed_registration',
);
}
}

View file

@ -43,7 +43,6 @@ class Space extends Model
'assistant_hide_third_party_account',
'copyright_text',
'intro_registration_text',
'confirmed_registration_text',
'newsletter_registration_address',
'account_proxy_registrar_address',
'account_realm'

View file

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('spaces', function (Blueprint $table) {
$table->dropColumn('confirmed_registration_text');
});
}
public function down(): void
{
Schema::table('spaces', function (Blueprint $table) {
$table->text('confirmed_registration_text')->nullable();
});
}
};

View file

@ -46,13 +46,6 @@
@include('parts.errors', ['name' => 'intro_registration_text'])
</div>
<div class="large">
<textarea name="confirmed_registration_text" id="confirmed_registration_text">{{ $space->confirmed_registration_text }}</textarea>
<label for="confirmed_registration_text">{{ __('Confirmed registration text') }}</label>
<span class="supporting">{{ __('Markdown text') }}</span>
@include('parts.errors', ['name' => 'confirmed_registration_text'])
</div>
<div>
<input name="newsletter_registration_address" id="newsletter_registration_address" placeholder="email@server.tld" type="email" value="{{ $space->newsletter_registration_address }}">
<label for="newsletter_registration_address">{{ __('Newsletter registration email address') }}</label>

View file

@ -162,7 +162,6 @@ JSON parameters:
* `expire_at` date, the moment the space is expiring, default to `null` (never expire)
* `copyright_text` text, the copyright text
* `intro_registration_text` Markdown text, the main registration page text
* `confirmed_registration_text` Markdown text, the text displayed in the registration email
* `newsletter_registration_address`, the newsletter registration email address
* `account_proxy_registrar_address`, the account proxy registrar address
* `account_realm`, the default realm for the accounts, fallback to the domain if not set
@ -199,7 +198,6 @@ JSON parameters:
* `expire_at` **required**, date, the moment the space is expiring, set to `null` to never expire
* `copyright_text` **required**, text, the copyright text
* `intro_registration_text` **required**, Markdown text, the main registration page text
* `confirmed_registration_text` **required**, Markdown text, the text displayed in the registration email
* `newsletter_registration_address`, **required**, the newsletter registration email address
* `account_proxy_registrar_address`, **required**, the account proxy registrar address
* `account_realm`, **required**, the default realm for the accounts, fallback to the domain if not set

View file

@ -1,26 +0,0 @@
@extends('mails.layout')
@section('content')
# Welcome to {{ $account->space->name }}
Hello {{ $account->identifier }},
@if ($account->space->confirmed_registration_text)
{{ strip_tags(parsedown($account->space->confirmed_registration_text)) }}
@else
Your SIP account has been successfully created.
You can now configure this account on any SIP-compatible application using the following parameters:
@endif
* SIP address: sip:{{ $account->identifier }}
* Username: {{ $account->username }}
* Domain: {{ $account->domain }}
@if (!empty($account->space->account_proxy_registrar_address))
* Proxy/registrar address: sip:{{ $account->space->account_proxy_registrar_address }}
@endif
@if (!empty(config('app.transport_protocol_text')))
* Transport: {{ config('app.transport_protocol_text') }}
@endif
@endsection