Skip to content

Commit

Permalink
Fix #102 test email
Browse files Browse the repository at this point in the history
  • Loading branch information
MaKyOtOx committed Oct 20, 2021
1 parent 20edc62 commit 4f6d6f8
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.7-slim
MAINTAINER Patrowl.io "getsupport@patrowl.io"
LABEL Name="PatrowlHears" Version="1.0.12"
LABEL Name="PatrowlHears" Version="1.0.13"

ENV PYTHONUNBUFFERED 1
RUN mkdir -p /opt/patrowl-hears/
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ cd PatrowlHears
docker-compose up
```
- Open your browser on http://localhost:8383
* default username: admin
* default password: Bonjour1!
* default username: `admin`
* default password: `Bonjour1!`
- Load initial DB records and latest updates:
```
docker-compose exec patrowlhears bash -c 'cd backend_app && ./load_init_data.sh'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ A commercial Pro Edition is available and officially supported by the PatrOwl co
**PatrowlHears** is available on the official PatrOwl SaaS platform or on-premise.
See: https://patrowl.io/products/hears

# Commercial Services
# Commercial Support and Services
Looking for advanced support, training, integration, custom developments, dual-licensing ? Contact us at getsupport@patrowl.io

# Security contact
Expand Down
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Front-end
- [ ] Settings/Sync: show data sync menu if started in slave mode only
- [ ] Vuln details: Support edition
- [ ] Dashboards on monitored items:
- NB vulnerabilities with exploits + network
- NB vulnerabilities with exploits + local
- Publication (90j, 90-30j, 30-7j, <7j)/Vuln severities {l/m/h/c}/

Back-end
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.12 // Community Edition
1.0.13 // Community Edition
2 changes: 1 addition & 1 deletion backend_app/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.12
1.0.13
15 changes: 15 additions & 0 deletions backend_app/alerts/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,18 @@ def send_vuln_update_slack(self, vuln_id):
from backend_app import slack
slack.send_slack_message("test", settings.ALERTING_SLACK_APITOKEN, "hears-admin-test")
return JsonResponse("enqueued.", safe=False)


@api_view(['GET'])
def send_test_email(self):
org_id = self.session.get('org_id', None)
org = organization.get_current_organization(user=self.user, org_id=org_id)
if org is None or org.org_settings.alerts_emails is None or len(org.org_settings.alerts_emails) == 0:
return JsonResponse({"status": "error", "reason": "no saved emails"}, safe=False)

send_email_message_task.apply_async(
args=["PatrowlHears - Test Email", {}, 'test_email', org.org_settings.alerts_emails],
queue='default',
retry=False
)
return JsonResponse({"status": "success",}, safe=False)
2 changes: 2 additions & 0 deletions backend_app/alerts/templates/test_email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is a test !<br/>
-- Sent by PatrowlHears - Visit <a href="https://patrowl.io">patrowl.io</a>
2 changes: 2 additions & 0 deletions backend_app/alerts/templates/test_email.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is a test !
-- Sent by PatrowlHears - Visit https://patrowl.io
1 change: 1 addition & 0 deletions backend_app/alerts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
path('products/report-monitored/monthly', apis.get_monitored_products_report_monthly, name='get_monitored_products_report_monthly'),
path('products/report-monitored/<int:days>', apis.get_monitored_products_report_by_days, name='get_monitored_products_report_by_days'),
path('vuln/<vuln_id>/slack', apis.send_vuln_update_slack, name='send_vuln_update_slack'),
path('email/test', apis.send_test_email, name='send_test_email'),
# path('cves/report/weekly', apis.get_dailymail_report_cves, name='get_dailymail_report_cves'),
]
2 changes: 1 addition & 1 deletion frontend/VERSION.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.12",
"version": "1.0.13",
"edition": "Community",
"build": ""
}
2 changes: 1 addition & 1 deletion frontend/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>PatrowlHears</title><link href="/static/css/app.05e53b51.css" rel="preload" as="style"><link href="/static/css/chunk-vendors.a17e3caa.css" rel="preload" as="style"><link href="/static/js/app.bcdab7a6.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.1f34b2b5.js" rel="preload" as="script"><link href="/static/css/chunk-vendors.a17e3caa.css" rel="stylesheet"><link href="/static/css/app.05e53b51.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.1f34b2b5.js"></script><script src="/static/js/app.bcdab7a6.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>PatrowlHears</title><link href="/static/css/app.05e53b51.css" rel="preload" as="style"><link href="/static/css/chunk-vendors.a17e3caa.css" rel="preload" as="style"><link href="/static/js/app.e16839f6.js" rel="preload" as="script"><link href="/static/js/chunk-vendors.1f34b2b5.js" rel="preload" as="script"><link href="/static/css/chunk-vendors.a17e3caa.css" rel="stylesheet"><link href="/static/css/app.05e53b51.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/static/js/chunk-vendors.1f34b2b5.js"></script><script src="/static/js/app.e16839f6.js"></script></body></html>
2 changes: 0 additions & 2 deletions frontend/dist/static/js/app.bcdab7a6.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/dist/static/js/app.bcdab7a6.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/dist/static/js/app.e16839f6.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/dist/static/js/app.e16839f6.js.map

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions frontend/src/components/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@
<v-icon left dark>mdi-check</v-icon>
Save Changes
</v-btn>
<v-btn
color="deep-orange"
:loading="loading"
@click.native="sendTestEmail"
>
<v-icon left dark>mdi-cog</v-icon>
Send test email
</v-btn>
</v-card-actions>
</v-card>
</v-col>
Expand Down Expand Up @@ -1122,6 +1130,24 @@ export default {
this.snackText = 'Unable to update user profile :/';
});
},
sendTestEmail() {
this.$api.get('/api/alerts/email/test').then(res => {
if (res && res.status === 200 && res.data.status == "success") {
// Snack notifications
this.snack = true;
this.snackColor = 'success';
this.snackText = 'Test sent. Check your mailbox !';
} else {
this.snack = true;
this.snackColor = 'error';
this.snackText = 'Unable to send test email: ' + res.data.reason;
}
}).catch(e => {
this.snack = true;
this.snackColor = 'error';
this.snackText = 'Unable to send test email';
});
},
updateUserToken() {
var bodyFormData = new FormData();
this.$api.get('/users/token/renew').then(res => {
Expand Down

0 comments on commit 4f6d6f8

Please sign in to comment.