mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Fix #104 Return validation URL when creation an account creation request token
This commit is contained in:
parent
8570aaae15
commit
04352d582a
2 changed files with 10 additions and 0 deletions
|
|
@ -27,9 +27,17 @@ class AccountCreationRequestToken extends Model
|
|||
use HasFactory;
|
||||
|
||||
protected $hidden = ['id', 'updated_at', 'created_at'];
|
||||
protected $appends = ['validation_url'];
|
||||
|
||||
public function accountCreationToken()
|
||||
{
|
||||
return $this->belongsTo(AccountCreationToken::class, 'acc_creation_token_id');
|
||||
}
|
||||
|
||||
public function getValidationUrlAttribute(): ?string
|
||||
{
|
||||
return $this->validated_at == null
|
||||
? route('account.creation_request_token.check', $this->token)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ class ApiAccountCreationTokenTest extends TestCase
|
|||
$response->assertStatus(201);
|
||||
$creationRequestToken = $response->json()['token'];
|
||||
|
||||
$this->assertSame($response->json()['validation_url'], route('account.creation_request_token.check', $creationRequestToken));
|
||||
|
||||
// Validate the creation request token
|
||||
AccountCreationRequestToken::where('token', $creationRequestToken)->update(['validated_at' => Carbon::now()]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue