test env seems to work
This commit is contained in:
parent
416960ac6c
commit
6e821c6ee9
@ -46,10 +46,7 @@ var app = new Vue({
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status != 'success')
|
||||
console.error('getForms error: '+data.msg)
|
||||
else
|
||||
this.forms = data.data
|
||||
this.forms = data.data
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
@ -62,9 +59,6 @@ var app = new Vue({
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status != 'success')
|
||||
console.error('getForms error: '+data.msg)
|
||||
else
|
||||
this.users = data.data
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -75,6 +75,9 @@ mongodb_dbname = get_env('MONGODB_DBNAME', 'contact_mailer')
|
||||
# Security
|
||||
admin_password = get_env('ADMIN_PASSWORD')
|
||||
|
||||
# Test purpose, do not send mail
|
||||
do_not_send = get_env('do_not_send', 'false') == 'true'
|
||||
|
||||
if 'SMTP_SSL' in os.environ and os.environ['SMTP_SSL'] == 'true':
|
||||
security = 'ssl'
|
||||
elif 'SMTP_STARTTLS' in os.environ and os.onviron['SMTP_STARTTLS'] == 'true':
|
||||
@ -189,6 +192,11 @@ def send_mail (from_address, to, subject, content):
|
||||
msg.set_content(MIMEText(content, 'plain', "utf-8"))
|
||||
#or
|
||||
#msg.set_content(content)
|
||||
if do_not_send:
|
||||
print('------------------------------------ Following message wont be sent ------------------------------------')
|
||||
print(msg.as_string())
|
||||
print('--------------------------------------------------------------------------------------------------------')
|
||||
return True
|
||||
|
||||
# SMTP preambles
|
||||
if security == 'ssl':
|
||||
@ -254,11 +262,9 @@ def create_form ():
|
||||
if 'mail' in request.forms:
|
||||
mail = request.forms.getunicode('mail')
|
||||
else:
|
||||
return resp(4000, 'Le champs « adresse » est requis')
|
||||
return resp(400, 'Le champs « adresse » est requis')
|
||||
|
||||
user = login(request)
|
||||
print('post form')
|
||||
print(user)
|
||||
if user['_privilege'] > 1:
|
||||
return resp(400, 'Privilèges insufisants')
|
||||
|
||||
|
@ -12,15 +12,16 @@ services:
|
||||
- db
|
||||
environment:
|
||||
MONGODB_HOST: db
|
||||
SMTP_SERVER_ADDRESS: 'lol'
|
||||
SMTP_SERVER_ADDRESS: toto.mail
|
||||
SMTP_SERVER_PORT: 994
|
||||
SMTP_SERVER_USERNAME: toto
|
||||
SMTP_SERVER_PASSWORD: lol
|
||||
SMTP_SERVER_SENDER: moi
|
||||
SMTP_SERVER_USERNAME: toto@toto.mail
|
||||
SMTP_SERVER_PASSWORD: password
|
||||
SMTP_SERVER_SENDER: toto@toto.mail
|
||||
ADMIN_PASSWORD: test
|
||||
SMTP_SSL: 'true'
|
||||
UID: 101
|
||||
MOUNT: /api
|
||||
do_not_send: 'true'
|
||||
|
||||
|
||||
proxy:
|
||||
|
@ -8,7 +8,10 @@
|
||||
<div id="contact-mailer-message"></div>
|
||||
<form action="/api/submit" method="POST" id="contact-mailer-form">
|
||||
<noscript>Les protections anti-spam, nécéssitent l’utilisation de javascript. Rien d’intrusif normalement.</noscript>
|
||||
<input type="hidden" name="token" value="5NwE8KOzhinBLVloZrvfb71WJeQ6sXc4xgC0AqFPDHGMjIdmUk" />
|
||||
<div>
|
||||
<label for="token">Token :</label>
|
||||
<input type="text" name="token"/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="nom">Votre nom :</label>
|
||||
<input type="text" name="nom" required="required"/>
|
||||
@ -31,6 +34,6 @@
|
||||
</div>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
<script class="contact-form-config" form-id="contact-mailer-form" notify-theme="plain" src="./client/index.js" integrity="sha384-PmKhlZlIlO1+jQGHGdfScCV2ksmoqXL04TOXOd1tn5q7VJJHLxAZUyZr7hzDLUOe"></script>
|
||||
<script class="contact-form-config" form-id="contact-mailer-form" notify-theme="plain" src="../client/index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -23,13 +23,9 @@ http {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, OPTIONS';
|
||||
listen 8080;
|
||||
location /admin {
|
||||
alias /usr/app/adminer;
|
||||
index index.html;
|
||||
}
|
||||
location / {
|
||||
root /usr/app/test;
|
||||
index test.html;
|
||||
root /usr/app/;
|
||||
index index.html;
|
||||
}
|
||||
location /api/ {
|
||||
include uwsgi_params;
|
||||
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# docker run -it --rm --network host mongo
|
||||
# nginx -c "$(pwd)"/nginx.conf -g "pid '$(pwd)/nginx.pid';"
|
||||
# . venv/bin/activate ; python3 main.py
|
Loading…
Reference in New Issue
Block a user