mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-02 12:13:54 +01:00
@@ -17,6 +17,9 @@ export default {
|
||||
getRandomPassword() {
|
||||
return repository.get(`${resource}/random_password/`)
|
||||
},
|
||||
getCredentials(accountId) {
|
||||
return repository.get(`credentials/${accountId}/`, { responseType: 'blob' })
|
||||
},
|
||||
validate(data) {
|
||||
return repository.post(`${resource}/validate/`, data)
|
||||
},
|
||||
|
||||
@@ -362,9 +362,9 @@ function getMenuItems(item) {
|
||||
result.push({
|
||||
label: element.label,
|
||||
icon: element.icon,
|
||||
onClick: () => {
|
||||
if (element.type === 'download') {
|
||||
//TODO : downloadFile(element)
|
||||
onClick: (account) => {
|
||||
if (element.name === 'get_credentials') {
|
||||
downloadCredentials(account)
|
||||
}
|
||||
fetchIdentities()
|
||||
},
|
||||
@@ -438,6 +438,16 @@ async function deleteAccount(account) {
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadCredentials(account) {
|
||||
const resp = await accountsApi.getCredentials(account.pk)
|
||||
const blob = new Blob([resp.data], { type: resp.headers['Content-Type'] })
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = `credentials_${account.pk}.pdf`
|
||||
link.click()
|
||||
URL.revokeObjectURL(link.href)
|
||||
}
|
||||
|
||||
function editAlias() {}
|
||||
|
||||
function deleteIdentities() {}
|
||||
|
||||
Reference in New Issue
Block a user