Hotfix 1.5 to 1.4

This commit is contained in:
Timothée Jaussoin 2024-07-04 08:25:17 +00:00
parent 09ec7ee043
commit 6c8b5aebdb
6 changed files with 33 additions and 5 deletions

View file

@ -367,8 +367,8 @@ IMPP:sip:' . $this->getIdentifierAttribute();
$vcard .= '
FN:';
$vcard .= !empty($this->attributes['display_name'])
? $this->attributes['display_name']
$vcard .= !empty($this->display_name)
? $this->display_name
: $this->getIdentifierAttribute();
if ($this->dtmf_protocol) {

View file

@ -120,7 +120,7 @@ function captchaConfigured(): bool
function resolveUserContacts(Request $request)
{
$selected = ['id', 'username', 'domain', 'activated', 'dtmf_protocol'];
$selected = ['id', 'username', 'domain', 'activated', 'dtmf_protocol', 'display_name'];
return Account::whereIn('id', function ($query) use ($request) {
$query->select('contact_id')

View file

@ -80,6 +80,29 @@ class AuthenticateController extends Controller
return redirect()->back()->withErrors(['authentication' => 'Wrong username or password']);
}
/**
* Deprecated
*/
public function validateEmail(Request $request, string $code)
{
$request->merge(['code' => $code]);
$request->validate(['code' => 'required|size:' . self::$emailCodeSize]);
$account = Account::where('confirmation_key', $code)->first();
if (!$account) {
return redirect()->route('account.login');
}
$account->confirmation_key = null;
$account->activated = true;
$account->save();
Auth::login($account);
return redirect()->route('dashboard');
}
public function loginAuthToken(Request $request, ?string $token = null)
{
$authToken = null;

View file

@ -35,7 +35,7 @@ class AccountFactory extends Factory
{
return [
'username' => $this->faker->username,
'display_name' => $this->faker->username,
'display_name' => $this->faker->name,
'domain' => config('app.sip_domain'),
'email' => $this->faker->email,
'user_agent' => $this->faker->userAgent,

View file

@ -47,6 +47,9 @@ Route::middleware(['web_panel_enabled'])->group(function () {
Route::post('authenticate', 'Account\AuthenticateController@authenticate')->name('account.authenticate');
Route::get('authenticate/qrcode/{token?}', 'Account\AuthenticateController@loginAuthToken')->name('account.authenticate.auth_token');
// Deprecated
Route::get('authenticate/email/{code}', 'Account\AuthenticateController@validateEmail')->name('account.authenticate.email_confirm');
Route::prefix('creation_token')->controller(CreationRequestTokenController::class)->group(function () {
Route::get('check/{token}', 'check')->name('account.creation_request_token.check');
Route::post('validate', 'validateToken')->name('account.creation_request_token.validate');

View file

@ -102,6 +102,8 @@ class AccountProvisioningTest extends TestCase
public function testAuthenticatedReProvisioning()
{
$password = Password::factory()->create();
$password->account->display_name = "Anna O'Reily";
$password->account->save();
$password->account->generateApiKey();
$provisioningToken = $password->account->provisioning_token;
@ -126,7 +128,7 @@ class AccountProvisioningTest extends TestCase
->assertStatus(200)
->assertHeader('Content-Type', 'application/xml')
->assertSee($password->account->username)
->assertSee($password->account->display_name)
->assertSee($password->account->display_name, false)
->assertSee('ha1');
}