diff --git a/flexiapi/app/Http/Requests/CreateAccountRequest.php b/flexiapi/app/Http/Requests/CreateAccountRequest.php new file mode 100644 index 0000000..d1d23f8 --- /dev/null +++ b/flexiapi/app/Http/Requests/CreateAccountRequest.php @@ -0,0 +1,37 @@ + [ + 'required', + Rule::unique('accounts', 'username')->where(function ($query) { + $query->where('domain', config('app.sip_domain')); + }), + 'filled', + ], + 'password' => 'required|min:3', + 'email' => 'nullable|email', + 'phone' => [ + 'nullable', + 'unique:aliases,alias', + 'unique:accounts,username', + new WithoutSpaces, 'starts_with:+' + ] + ]; + } +} diff --git a/flexiapi/app/Http/Requests/UpdateAccountRequest.php b/flexiapi/app/Http/Requests/UpdateAccountRequest.php new file mode 100644 index 0000000..af1aab4 --- /dev/null +++ b/flexiapi/app/Http/Requests/UpdateAccountRequest.php @@ -0,0 +1,39 @@ + [ + 'required', + Rule::unique('accounts', 'username')->where(function ($query) { + $query->where('domain', config('app.sip_domain')); + })->ignore($this->route('id'), 'id'), + 'filled', + ], + 'email' => 'nullable|email', + 'password_sha256' => 'nullable|min:3', + 'phone' => [ + 'nullable', + Rule::unique('accounts', 'username')->where(function ($query) { + $query->where('domain', config('app.sip_domain')); + })->ignore($this->route('id'), 'id'), + Rule::unique('aliases', 'alias')->ignore($this->route('id'), 'account_id'), + new WithoutSpaces, 'starts_with:+' + ] + ]; + } +} diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index 0a5b138..9334eec 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 90 +%define build_number 91 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager