diff --git a/adminer/index.js b/adminer/index.js index bb0686d..fa70d9f 100644 --- a/adminer/index.js +++ b/adminer/index.js @@ -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) => { diff --git a/server/main.py b/server/main.py index da2e42f..3d0583c 100755 --- a/server/main.py +++ b/server/main.py @@ -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') diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 7923003..e1900f5 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -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: diff --git a/test/test.html b/test/index.html similarity index 81% rename from test/test.html rename to test/index.html index 7d98958..dfea6c3 100644 --- a/test/test.html +++ b/test/index.html @@ -8,7 +8,10 @@
- +