Updated generate alias parameter
This commit is contained in:
parent
ba3772219e
commit
3828d27012
4 changed files with 22 additions and 8 deletions
|
@ -31,7 +31,7 @@ class AliasController extends Controller
|
||||||
return response('', 429);
|
return response('', 429);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->uuid === false) {
|
if ($request->input('format', 'uuid') === 'random_words') {
|
||||||
$localPart = user()->generateRandomWordLocalPart();
|
$localPart = user()->generateRandomWordLocalPart();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
|
|
@ -31,7 +31,7 @@ class StoreAliasRequest extends FormRequest
|
||||||
Rule::in($this->user()->domainOptions())
|
Rule::in($this->user()->domainOptions())
|
||||||
],
|
],
|
||||||
'description' => 'nullable|max:100',
|
'description' => 'nullable|max:100',
|
||||||
'uuid' => 'nullable|boolean'
|
'format' => 'nullable|in:uuid,random_words'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,13 +384,17 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="block relative w-full mb-4">
|
<div class="block relative w-full mb-4">
|
||||||
<select
|
<select
|
||||||
v-model="generateAliasIsUuid"
|
v-model="generateAliasFormat"
|
||||||
id="alias_domain"
|
id="alias_domain"
|
||||||
class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:shadow-outline"
|
class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:shadow-outline"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<option :value="true">UUID</option>
|
<option
|
||||||
<option :value="false">Random Words</option>
|
v-for="formatOption in aliasFormatOptions"
|
||||||
|
:key="formatOption.value"
|
||||||
|
:value="formatOption.value"
|
||||||
|
>{{ formatOption.label }}</option
|
||||||
|
>
|
||||||
</select>
|
</select>
|
||||||
<div
|
<div
|
||||||
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
|
class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
|
||||||
|
@ -599,7 +603,17 @@ export default {
|
||||||
generateAliasLoading: false,
|
generateAliasLoading: false,
|
||||||
generateAliasDomain: this.domain,
|
generateAliasDomain: this.domain,
|
||||||
generateAliasDescription: '',
|
generateAliasDescription: '',
|
||||||
generateAliasIsUuid: true,
|
generateAliasFormat: 'uuid',
|
||||||
|
aliasFormatOptions: [
|
||||||
|
{
|
||||||
|
value: 'uuid',
|
||||||
|
label: 'UUID',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'random_words',
|
||||||
|
label: 'Random Words',
|
||||||
|
},
|
||||||
|
],
|
||||||
recipientsAliasToEdit: {},
|
recipientsAliasToEdit: {},
|
||||||
aliasRecipientsToEdit: [],
|
aliasRecipientsToEdit: [],
|
||||||
columns: [
|
columns: [
|
||||||
|
@ -777,7 +791,7 @@ export default {
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
domain: this.generateAliasDomain,
|
domain: this.generateAliasDomain,
|
||||||
description: this.generateAliasDescription,
|
description: this.generateAliasDescription,
|
||||||
uuid: this.generateAliasIsUuid,
|
format: this.generateAliasFormat,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AliasesTest extends TestCase
|
||||||
$response = $this->json('POST', '/api/v1/aliases', [
|
$response = $this->json('POST', '/api/v1/aliases', [
|
||||||
'domain' => 'anonaddy.me',
|
'domain' => 'anonaddy.me',
|
||||||
'description' => 'the description',
|
'description' => 'the description',
|
||||||
'uuid' => false
|
'format' => 'random_words'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertStatus(201);
|
$response->assertStatus(201);
|
||||||
|
|
Loading…
Add table
Reference in a new issue