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);
|
||||
}
|
||||
|
||||
if ($request->uuid === false) {
|
||||
if ($request->input('format', 'uuid') === 'random_words') {
|
||||
$localPart = user()->generateRandomWordLocalPart();
|
||||
|
||||
$data = [
|
||||
|
|
|
@ -31,7 +31,7 @@ class StoreAliasRequest extends FormRequest
|
|||
Rule::in($this->user()->domainOptions())
|
||||
],
|
||||
'description' => 'nullable|max:100',
|
||||
'uuid' => 'nullable|boolean'
|
||||
'format' => 'nullable|in:uuid,random_words'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,13 +384,17 @@
|
|||
</label>
|
||||
<div class="block relative w-full mb-4">
|
||||
<select
|
||||
v-model="generateAliasIsUuid"
|
||||
v-model="generateAliasFormat"
|
||||
id="alias_domain"
|
||||
class="block appearance-none w-full text-grey-700 bg-grey-100 p-3 pr-8 rounded shadow focus:shadow-outline"
|
||||
required
|
||||
>
|
||||
<option :value="true">UUID</option>
|
||||
<option :value="false">Random Words</option>
|
||||
<option
|
||||
v-for="formatOption in aliasFormatOptions"
|
||||
:key="formatOption.value"
|
||||
:value="formatOption.value"
|
||||
>{{ formatOption.label }}</option
|
||||
>
|
||||
</select>
|
||||
<div
|
||||
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,
|
||||
generateAliasDomain: this.domain,
|
||||
generateAliasDescription: '',
|
||||
generateAliasIsUuid: true,
|
||||
generateAliasFormat: 'uuid',
|
||||
aliasFormatOptions: [
|
||||
{
|
||||
value: 'uuid',
|
||||
label: 'UUID',
|
||||
},
|
||||
{
|
||||
value: 'random_words',
|
||||
label: 'Random Words',
|
||||
},
|
||||
],
|
||||
recipientsAliasToEdit: {},
|
||||
aliasRecipientsToEdit: [],
|
||||
columns: [
|
||||
|
@ -777,7 +791,7 @@ export default {
|
|||
JSON.stringify({
|
||||
domain: this.generateAliasDomain,
|
||||
description: this.generateAliasDescription,
|
||||
uuid: this.generateAliasIsUuid,
|
||||
format: this.generateAliasFormat,
|
||||
}),
|
||||
{
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
|
|
@ -71,7 +71,7 @@ class AliasesTest extends TestCase
|
|||
$response = $this->json('POST', '/api/v1/aliases', [
|
||||
'domain' => 'anonaddy.me',
|
||||
'description' => 'the description',
|
||||
'uuid' => false
|
||||
'format' => 'random_words'
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
|
|
Loading…
Add table
Reference in a new issue