Add a toggle to disable public account registration

This commit is contained in:
Timothée Jaussoin 2021-08-02 15:42:23 +02:00
parent 2b9921515c
commit 877cae94f7
10 changed files with 63 additions and 47 deletions

View file

@ -24,7 +24,8 @@ INSTANCE_CUSTOM_THEME=false
INSTANCE_CONFIRMED_REGISTRATION_TEXT= # Markdown text displayed when an account is confirmed
NEWSLETTER_REGISTRATION_ADDRESS= # Address to contact when a user wants to register to the newsletter
PHONE_AUTHENTICATION=true # Toggle to enable/disable the SMS support
PUBLIC_REGISTRATION=true # Toggle to enable/disable the public registration forms
PHONE_AUTHENTICATION=true # Toggle to enable/disable the SMS support, requires public registration
DEVICES_MANAGEMENT=false # Toggle to enable/disable the devices management support
TERMS_OF_USE_URL= # A URL pointing to the Terms of Use

View file

@ -13,8 +13,10 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
// Add following lines to force laravel to use APP_URL as root url for the app.
$strBaseURL = $this->app['url'];
$strBaseURL->forceRootUrl(config('app.url'));
if (!empty(config('app.url'))) {
// Add following lines to force laravel to use APP_URL as root url for the app.
$strBaseURL = $this->app['url'];
$strBaseURL->forceRootUrl(config('app.url'));
}
}
}

38
flexiapi/composer.lock generated
View file

@ -2390,16 +2390,16 @@
},
{
"name": "ramsey/collection",
"version": "1.1.3",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/ramsey/collection.git",
"reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1"
"reference": "ab2237657ad99667a5143e32ba2683c8029563d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/collection/zipball/28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1",
"reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1",
"url": "https://api.github.com/repos/ramsey/collection/zipball/ab2237657ad99667a5143e32ba2683c8029563d4",
"reference": "ab2237657ad99667a5143e32ba2683c8029563d4",
"shasum": ""
},
"require": {
@ -2451,7 +2451,7 @@
],
"support": {
"issues": "https://github.com/ramsey/collection/issues",
"source": "https://github.com/ramsey/collection/tree/1.1.3"
"source": "https://github.com/ramsey/collection/tree/1.1.4"
},
"funding": [
{
@ -2463,7 +2463,7 @@
"type": "tidelift"
}
],
"time": "2021-01-21T17:40:04+00:00"
"time": "2021-07-30T00:58:27+00:00"
},
{
"name": "ramsey/uuid",
@ -5602,16 +5602,16 @@
},
{
"name": "maximebf/debugbar",
"version": "v1.17.0",
"version": "v1.17.1",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d"
"reference": "0a3532556be0145603f8a9de23e76dc28eed7054"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/4ef8e359d9fffbfbce26218ee36f196453a4dd7d",
"reference": "4ef8e359d9fffbfbce26218ee36f196453a4dd7d",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/0a3532556be0145603f8a9de23e76dc28eed7054",
"reference": "0a3532556be0145603f8a9de23e76dc28eed7054",
"shasum": ""
},
"require": {
@ -5661,9 +5661,9 @@
],
"support": {
"issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/v1.17.0"
"source": "https://github.com/maximebf/php-debugbar/tree/v1.17.1"
},
"time": "2021-07-27T05:47:57+00:00"
"time": "2021-08-01T09:19:02+00:00"
},
{
"name": "mockery/mockery",
@ -6539,16 +6539,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.7",
"version": "9.5.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5"
"reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5",
"reference": "d0dc8b6999c937616df4fb046792004b33fd31c5",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb",
"reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb",
"shasum": ""
},
"require": {
@ -6560,7 +6560,7 @@
"ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.1",
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.12.1",
@ -6626,7 +6626,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8"
},
"funding": [
{
@ -6638,7 +6638,7 @@
"type": "github"
}
],
"time": "2021-07-19T06:14:47+00:00"
"time": "2021-07-31T15:17:34+00:00"
},
{
"name": "sebastian/cli-parser",

View file

@ -23,11 +23,13 @@ return [
'newsletter_registration_address' => env('NEWSLETTER_REGISTRATION_ADDRESS', ''),
'phone_authentication' => env('PHONE_AUTHENTICATION', true),
'public_registration' => env('PUBLIC_REGISTRATION', true),
'devices_management' => env('DEVICES_MANAGEMENT', false),
'proxy_registrar_address' => env('ACCOUNT_PROXY_REGISTRAR_ADDRESS', 'sip.domain.com'),
'transport_protocol_text' => env('ACCOUNT_TRANSPORT_PROTOCOL_TEXT', 'TLS (recommended), TCP or UDP'),
/**
* Account provisioning
*/

View file

@ -10,7 +10,11 @@ Registration can be achieve using two methods if they are correctly configured a
## Email Registration
You can [create an account using an email address]({{ route('account.register.email') }}). The form requires you to provide an username and your email address.
@if (!config('app.public_registration'))
*The feature is not enabled on this instance.*
@endif
You can @if (config('app.public_registration')) [create an account using an email address]({{ route('account.register.email') }}) @else create an account using an email address @endif. The form requires you to provide an username and your email address.
Once completed a confirmation email containing a unique link will be sent to the address. This link is used to activate your account, allowing you to finish the setup.

View file

@ -13,12 +13,14 @@
<hr />
<div class="list-group mb-3">
<a href="{{ route('account.register') }}" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Create an account</h5>
</div>
<p class="mb-1">Register on our service</p>
</a>
@if (config('app.public_registration'))
<a href="{{ route('account.register') }}" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Create an account</h5>
</div>
<p class="mb-1">Register on our service</p>
</a>
@endif
<a href="{{ route('account.login') }}" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Manage your account</h5>

View file

@ -28,11 +28,13 @@
@include('parts.password_recovery')
@endif
<hr />
@if (config('app.public_registration'))
<hr />
<p class="text-center">
No account yet?
<a class="btn btn-secondary ml-2" href="{{ route('account.register') }}">Register</a>
</p>
<p class="text-center">
No account yet?
<a class="btn btn-secondary ml-2" href="{{ route('account.register') }}">Register</a>
</p>
@endif
@endsection

View file

@ -15,9 +15,11 @@
</ul>
<ul class="navbar-nav">
<li class="nav-item @if (request()->routeIs('account.register')) active @endif">
<a class="nav-link" href="{{ route('account.register') }}">Register</a>
</li>
@if (config('app.public_registration'))
<li class="nav-item @if (request()->routeIs('account.register')) active @endif">
<a class="nav-link" href="{{ route('account.register') }}">Register</a>
</li>
@endif
<li class="nav-item @if (request()->routeIs('account.login')) active @endif">
<a class="nav-link" href="{{ route('account.login') }}">Login</a>
</li>

View file

@ -32,18 +32,19 @@ Route::get('login/phone', 'Account\AuthenticateController@loginPhone')->name('ac
Route::post('authenticate/phone', 'Account\AuthenticateController@authenticatePhone')->name('account.authenticate.phone');
Route::post('authenticate/phone/confirm', 'Account\AuthenticateController@validatePhone')->name('account.authenticate.phone_confirm');
Route::get('register', 'Account\RegisterController@register')->name('account.register');
Route::get('provisioning/qrcode/{confirmation}', 'Account\ProvisioningController@qrcode')->name('provisioning.qrcode');
Route::get('provisioning/{confirmation?}', 'Account\ProvisioningController@show')->name('provisioning.show');
if (config('app.phone_authentication')) {
Route::get('register/phone', 'Account\RegisterController@registerPhone')->name('account.register.phone');
Route::post('register/phone', 'Account\RegisterController@storePhone')->name('account.store.phone');
}
if (config('app.public_registration')) {
if (config('app.phone_authentication')) {
Route::get('register/phone', 'Account\RegisterController@registerPhone')->name('account.register.phone');
Route::post('register/phone', 'Account\RegisterController@storePhone')->name('account.store.phone');
}
Route::get('register/email', 'Account\RegisterController@registerEmail')->name('account.register.email');
Route::post('register/email', 'Account\RegisterController@storeEmail')->name('account.store.email');
Route::get('register', 'Account\RegisterController@register')->name('account.register');
Route::get('register/email', 'Account\RegisterController@registerEmail')->name('account.register.email');
Route::post('register/email', 'Account\RegisterController@storeEmail')->name('account.store.email');
}
Route::group(['middleware' => 'auth'], function () {
Route::get('panel', 'Account\AccountController@panel')->name('account.panel');

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 93
%define build_number 94
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager