mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-02-12 16:12:44 +00:00
Added more tests files
Fixed asset page should show all domains Fixed domain assets should not be shown as global Improve delete modal Remove preview icon background colors
This commit is contained in:
@@ -57,7 +57,7 @@ func (r *Asset) GetAllByDomainAndContext(
|
||||
db = db.
|
||||
Joins("left join domains on domains.id = assets.domain_id").
|
||||
Select(r.joinSelectString()).
|
||||
Where("(assets.company_id = ? OR assets.company_id IS NULL) AND (domain_id = ? OR domain_id IS NULL)", companyID, domainID)
|
||||
Where("(assets.company_id = ? OR assets.company_id IS NULL) AND domain_id = ?", companyID, domainID)
|
||||
} else {
|
||||
db.Where("assets.company_id = ?", companyID)
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func (r *Asset) GetAllByGlobalContext(
|
||||
}
|
||||
var dbModels []*database.Asset
|
||||
dbRes := db.
|
||||
Where("company_id IS NULL").
|
||||
Where("company_id IS NULL AND domain_id IS NULL").
|
||||
Find(&dbModels)
|
||||
|
||||
if dbRes.Error != nil {
|
||||
|
||||
1
backend/testfiles/assets/attachment-b.txt
Normal file
1
backend/testfiles/assets/attachment-b.txt
Normal file
@@ -0,0 +1 @@
|
||||
Hi {{.FirstName}} Welcome to The Phishing Club! We are excited to have you here. Click <a href='{{.URL}}'>here</a> to get started.
|
||||
BIN
backend/testfiles/assets/contoso-logo.png
Normal file
BIN
backend/testfiles/assets/contoso-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
BIN
backend/testfiles/assets/domain.tld/contoso-logo.png
Normal file
BIN
backend/testfiles/assets/domain.tld/contoso-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -1,3 +1,5 @@
|
||||
/** domain asset **/
|
||||
* {
|
||||
background-color: red;
|
||||
background: url(contoso-logo.png);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/** global asset **/
|
||||
* {
|
||||
background-color: yellow;
|
||||
background: url(contoso-logo.png);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
const refresh = async () => {
|
||||
try {
|
||||
isTableLoading = true;
|
||||
const res = await api.domain.getAll(tableURLParams, contextCompanyID);
|
||||
const res = await api.domain.getAllSubset(tableURLParams, contextCompanyID);
|
||||
if (!res.success) {
|
||||
throw res.error;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
let isDeleteAlertVisible = false;
|
||||
let deleteValues = {
|
||||
id: null,
|
||||
name: null
|
||||
name: null,
|
||||
path: null
|
||||
};
|
||||
let modalMode = null;
|
||||
let modalText = '';
|
||||
@@ -251,6 +252,7 @@
|
||||
isDeleteAlertVisible = true;
|
||||
deleteValues.id = asset.id;
|
||||
deleteValues.name = asset.name;
|
||||
deleteValues.path = asset.path;
|
||||
};
|
||||
|
||||
const onClickPreview = async (path) => {
|
||||
@@ -396,7 +398,7 @@
|
||||
<TableCell>
|
||||
{#if isImageFile(asset.path)}
|
||||
{#await getImagePreviewUrl(asset.path)}
|
||||
<div class="w-12 h-12 bg-gray-200 animate-pulse rounded"></div>
|
||||
<div class="w-12 h-12 animate-pulse rounded"></div>
|
||||
{:then imageUrl}
|
||||
{#if imageUrl}
|
||||
<button
|
||||
@@ -415,22 +417,18 @@
|
||||
</button>
|
||||
{:else}
|
||||
<div
|
||||
class="w-12 h-12 bg-gray-300 rounded flex items-center justify-center text-xs text-gray-600"
|
||||
class="w-12 h-12 rounded flex items-center justify-center text-xs text-gray-600"
|
||||
>
|
||||
No preview
|
||||
</div>
|
||||
{/if}
|
||||
{:catch}
|
||||
<div
|
||||
class="w-12 h-12 bg-red-100 rounded flex items-center justify-center text-xs text-red-600"
|
||||
>
|
||||
<div class="w-12 h-12 rounded flex items-center justify-center text-xs text-red-600">
|
||||
Error
|
||||
</div>
|
||||
{/await}
|
||||
{:else}
|
||||
<div
|
||||
class="w-12 h-12 bg-gray-100 rounded flex items-center justify-center text-xs text-gray-500"
|
||||
>
|
||||
<div class="w-12 h-12 rounded flex items-center justify-center text-xs text-gray-500">
|
||||
📄
|
||||
</div>
|
||||
{/if}
|
||||
@@ -513,7 +511,7 @@
|
||||
</FormGrid>
|
||||
</Modal>
|
||||
<DeleteAlert
|
||||
name={deleteValues.name}
|
||||
name={deleteValues.name || deleteValues.path || 'Unnamed asset'}
|
||||
onClick={() => onClickDelete(deleteValues.id)}
|
||||
bind:isVisible={isDeleteAlertVisible}
|
||||
></DeleteAlert>
|
||||
|
||||
Reference in New Issue
Block a user