diff --git a/flexiapi/.env.example b/flexiapi/.env.example index e4399b1..91f4940 100644 --- a/flexiapi/.env.example +++ b/flexiapi/.env.example @@ -44,6 +44,7 @@ MAIL_SIGNATURE="The Linphone Team" NEWSLETTER_REGISTRATION_ADDRESS= PHONE_AUTHENTICATION=true +DEVICES_MANAGEMENT=true OVH_APP_KEY= OVH_APP_SECRET= diff --git a/flexiapi/README.md b/flexiapi/README.md index 54ea411..c61c30a 100644 --- a/flexiapi/README.md +++ b/flexiapi/README.md @@ -71,7 +71,7 @@ We advise you to copy the `style.css` file and rename it to make your custom CSS ### systemd restrictions -To retrieve the devices configuration, FlexiAPI connects to the UNIX socket opened by FlexiSIP. The socket is located in the `/tmp` directory. +To retrieve the devices configuration, FlexiAPI connects to the UNIX socket opened by Flexisip. The socket is located in the `/tmp` directory. If you have issues connecting to that socket, please ensure that your PHP process have access to it (user, rights). The systemd service [PrivateTmp](https://access.redhat.com/blogs/766093/posts/1976243) setting might restrict that access. diff --git a/flexiapi/app/Http/Controllers/Account/AuthenticateController.php b/flexiapi/app/Http/Controllers/Account/AuthenticateController.php index 7176c1f..ddc6fec 100644 --- a/flexiapi/app/Http/Controllers/Account/AuthenticateController.php +++ b/flexiapi/app/Http/Controllers/Account/AuthenticateController.php @@ -49,8 +49,11 @@ class AuthenticateController extends Controller 'password' => 'required' ]); - $account = Account::where('username', $request->get('username')) - ->firstOrFail(); + $account = Account::where('username', $request->get('username'))->first(); + + if (!$account) { + return redirect()->back()->withErrors(['authentication' => 'The account doesn\'t exists']); + } // Try out the passwords foreach ($account->passwords as $password) { diff --git a/flexiapi/app/Http/Controllers/Account/RegisterController.php b/flexiapi/app/Http/Controllers/Account/RegisterController.php index 82e3e07..e572559 100644 --- a/flexiapi/app/Http/Controllers/Account/RegisterController.php +++ b/flexiapi/app/Http/Controllers/Account/RegisterController.php @@ -65,6 +65,7 @@ class RegisterController extends Controller { $request->validate([ 'terms' => 'accepted', + 'privacy' => 'accepted', 'username' => [ 'required', 'unique:external.accounts,username', 'filled', new WithoutSpaces ], @@ -101,6 +102,7 @@ class RegisterController extends Controller { $request->validate([ 'terms' =>'accepted', + 'privacy' => 'accepted', 'username' => 'unique:external.accounts,username|nullable|filled', 'phone' => [ 'required', 'unique:external.aliases,alias', diff --git a/flexiapi/app/Http/Controllers/AccountController.php b/flexiapi/app/Http/Controllers/AccountController.php index eadee7c..b3d117a 100644 --- a/flexiapi/app/Http/Controllers/AccountController.php +++ b/flexiapi/app/Http/Controllers/AccountController.php @@ -52,6 +52,11 @@ class AccountController extends Controller return view('account.terms'); } + public function privacy(Request $request) + { + return view('account.privacy'); + } + public function delete(Request $request) { return view('account.delete', [ diff --git a/flexiapi/composer.json b/flexiapi/composer.json index 6a9dbb2..1a5e069 100644 --- a/flexiapi/composer.json +++ b/flexiapi/composer.json @@ -15,6 +15,7 @@ "laravel/tinker": "^2.4", "laravelcollective/html": "^6.2", "ovh/ovh": "^2.0", + "parsedown/laravel": "^1.2", "propaganistas/laravel-phone": "^4.2" }, "require-dev": { diff --git a/flexiapi/composer.lock b/flexiapi/composer.lock index 03adba7..45f4019 100644 --- a/flexiapi/composer.lock +++ b/flexiapi/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5063139d9245c72528e7b86c22887d58", + "content-hash": "f32d08746d9f85a865c21dc34baf5713", "packages": [ { "name": "anhskohbo/no-captcha", @@ -430,6 +430,52 @@ ], "time": "2020-09-19T14:37:56+00:00" }, + { + "name": "erusev/parsedown", + "version": "1.7.4", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2019-12-30T22:54:17+00:00" + }, { "name": "fideloper/proxy", "version": "4.4.0", @@ -1811,6 +1857,63 @@ ], "time": "2018-07-02T15:55:56+00:00" }, + { + "name": "parsedown/laravel", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/parsedown/laravel.git", + "reference": "c713ffe28c76730754389180e86e93e8e84087e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/parsedown/laravel/zipball/c713ffe28c76730754389180e86e93e8e84087e7", + "reference": "c713ffe28c76730754389180e86e93e8e84087e7", + "shasum": "" + }, + "require": { + "erusev/parsedown": "^1.7", + "php": ">=7.1.3" + }, + "require-dev": { + "orchestra/testbench": "^3.8", + "php": ">=7.2", + "phpunit/phpunit": "^8.3" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Parsedown\\Providers\\ParsedownServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/Support/helpers.php" + ], + "psr-4": { + "Parsedown\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Agostini", + "email": "edu.agostini@gmail.com" + } + ], + "description": "Official Parsedown's Laravel Wrapper.", + "homepage": "http://parsedown.org", + "keywords": [ + "laravel", + "parsedown" + ], + "time": "2020-01-07T02:12:55+00:00" + }, { "name": "phpoption/phpoption", "version": "1.7.5", diff --git a/flexiapi/config/app.php b/flexiapi/config/app.php index 0345a86..46041b3 100644 --- a/flexiapi/config/app.php +++ b/flexiapi/config/app.php @@ -19,6 +19,7 @@ return [ 'newsletter_registration_address' => env('NEWSLETTER_REGISTRATION_ADDRESS', ''), 'phone_authentication' => env('PHONE_AUTHENTICATION', true), + 'devices_management' => env('DEVICES_MANAGEMENT', true), 'proxy_registrar_address' => env('ACCOUNT_PROXY_REGISTRAR_ADDRESS', 'sip.domain.com'), 'transport_protocol' => env('ACCOUNT_TRANSPORT_PROTOCOL', 'TLS (recommended), TCP or UDP'), diff --git a/flexiapi/resources/views/account/delete.blade.php b/flexiapi/resources/views/account/delete.blade.php index 8cf2147..281939c 100644 --- a/flexiapi/resources/views/account/delete.blade.php +++ b/flexiapi/resources/views/account/delete.blade.php @@ -7,7 +7,7 @@ {!! Form::open(['route' => 'account.destroy', 'method' => 'delete']) !!}
You are going to permanently delete your account.
-Please enter your username {{ $account->identifier }} to confirm.
+Please enter your complete username to confirm: {{ $account->identifier }}.
There are {{ number_format($count) }} users registered with this service.
+There are {{ number_format($count) }} users registered with this service.
@if (config('instance.intro_registration')) -{!! nl2br(config('instance.intro_registration')) !!}
+ @parsedown(config('instance.intro_registration')) @endif- No account yet? - Register -
- -+ No account yet? + Register +
+ @endsection \ No newline at end of file diff --git a/flexiapi/resources/views/account/panel.blade.php b/flexiapi/resources/views/account/panel.blade.php index 8a22d96..fd6eda6 100644 --- a/flexiapi/resources/views/account/panel.blade.php +++ b/flexiapi/resources/views/account/panel.blade.php @@ -15,12 +15,14 @@No email yet
@endif - -See and delete the devices linked to your account
- + @if (config('app.devices_management') == true) + +See and delete the devices linked to your account
+ + @endifManage the FlexiSIP accounts
+Manage the Flexisip accounts
Hello,
- Your SIP account has been successfully created using {{ config('app.name') }}.
+ Your SIP account has been successfully created.
You can now configure this account on any SIP-compatible application using the following parameters:
diff --git a/flexiapi/resources/views/mails/confirmed_registration_text.blade.php b/flexiapi/resources/views/mails/confirmed_registration_text.blade.php
index 23b93f4..e926501 100644
--- a/flexiapi/resources/views/mails/confirmed_registration_text.blade.php
+++ b/flexiapi/resources/views/mails/confirmed_registration_text.blade.php
@@ -2,7 +2,7 @@ Registration confirmed {{ config('app.name') }}
Hello,
-Your SIP account has been successfully created using {{ config('app.name') }}.
+Your SIP account has been successfully created.
You can now configure this account on any SIP-compatible application using the following parameters:
SIP address: sip:{{ $account->identifier }}
diff --git a/flexiapi/resources/views/parts/password_recovery.blade.php b/flexiapi/resources/views/parts/password_recovery.blade.php
index d0a6510..0ed8652 100644
--- a/flexiapi/resources/views/parts/password_recovery.blade.php
+++ b/flexiapi/resources/views/parts/password_recovery.blade.php
@@ -1,4 +1,4 @@
-
+
Set or recover your password using your Email address @if (config('app.phone_authentication')) or your Phone number diff --git a/flexiapi/resources/views/parts/terms.blade.php b/flexiapi/resources/views/parts/terms.blade.php index ef60467..cd644f8 100644 --- a/flexiapi/resources/views/parts/terms.blade.php +++ b/flexiapi/resources/views/parts/terms.blade.php @@ -4,4 +4,10 @@
Read the Terms and Conditions
Read the Privacy policy
+
+
|
+
| +{{ Illuminate\Mail\Markdown::parse($slot) }} + | +
+@else
+{{ $slot }}
+@endif
+
+
+
|
+
+
|
+
| +{{ Illuminate\Mail\Markdown::parse($slot) }} + | +