Merge pull request 'Release 0.1.1' (#13) from dev into main
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

Reviewed-on: #13
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
This commit is contained in:
Nicolai Ort 2021-03-31 17:49:04 +00:00
commit b47660af65
16 changed files with 892 additions and 191 deletions

View File

@ -1,5 +1,27 @@
---
kind: secret
name: docker_username
get:
path: odit-registry-builder
name: username
---
kind: secret
name: docker_password
get:
path: odit-registry-builder
name: password
---
kind: secret
name: git_ssh
get:
path: odit-git-bot
name: sshkey
---
kind: pipeline
type: kubernetes
name: tests:node_latest
clone:
disable: true
@ -20,7 +42,7 @@ trigger:
---
kind: pipeline
type: docker
type: kubernetes
name: build:dev
clone:
disable: true
@ -36,13 +58,14 @@ steps:
depends_on: [clone]
settings:
username:
from_secret: DOCKER_REGISTRY_USER
from_secret: docker_username
password:
from_secret: DOCKER_REGISTRY_PASSWORD
from_secret: docker_password
repo: registry.odit.services/lfk/mailer
tags:
- dev
registry: registry.odit.services
mtu: 1000
- name: run changelog export
depends_on: ["clone"]
image: node:latest
@ -58,7 +81,7 @@ steps:
author_email: bot@odit.services
remote: git@git.odit.services:lfk/mailer.git
ssh_key:
from_secret: GITLAB_SSHKEY
from_secret: git_ssh
- name: run full license export
depends_on: ["clone"]
image: node:14.15.1-alpine3.12
@ -76,7 +99,7 @@ steps:
remote: git@git.odit.services:lfk/mailer.git
skip_verify: true
ssh_key:
from_secret: GITLAB_SSHKEY
from_secret: git_ssh
trigger:
branch:
@ -86,7 +109,7 @@ trigger:
---
kind: pipeline
type: docker
type: kubernetes
name: build:latest
clone:
disable: true
@ -104,13 +127,14 @@ steps:
image: plugins/docker
settings:
username:
from_secret: DOCKER_REGISTRY_USER
from_secret: docker_username
password:
from_secret: DOCKER_REGISTRY_PASSWORD
from_secret: docker_password
repo: registry.odit.services/lfk/mailer
tags:
- latest
registry: registry.odit.services
mtu: 1000
- name: push merge to repo
depends_on: ["clone"]
image: appleboy/drone-git-push
@ -119,7 +143,7 @@ steps:
commit: false
remote: git@git.odit.services:lfk/mailer.git
ssh_key:
from_secret: GITLAB_SSHKEY
from_secret: git_ssh
trigger:
branch:
@ -129,7 +153,7 @@ trigger:
---
kind: pipeline
type: docker
type: kubernetes
name: build:tags
steps:
@ -138,13 +162,14 @@ steps:
depends_on: [clone]
settings:
username:
from_secret: DOCKER_REGISTRY_USER
from_secret: docker_username
password:
from_secret: DOCKER_REGISTRY_PASSWORD
from_secret: docker_password
repo: registry.odit.services/lfk/mailer
tags:
- '${DRONE_TAG}'
registry: registry.odit.services
mtu: 1000
trigger:
event:
- tag

View File

@ -2,4 +2,117 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### 0.1.0
#### [v0.1.1](https://git.odit.services/lfk/mailer/compare/v0.1.0...v0.1.1)
- Added mail templates for forgotten selfservice links [`56c3dec`](https://git.odit.services/lfk/mailer/commit/56c3deca574fc4501cc9b51128b4f3b0467d24c9)
- 🧾New changelog file version [CI SKIP] [skip ci] [`8996aef`](https://git.odit.services/lfk/mailer/commit/8996aef1523e079aec83b63df99c44173f3a43cc)
- 🚀Bumped version to v0.1.1 [`34e0c72`](https://git.odit.services/lfk/mailer/commit/34e0c729b542b026b997f25a33165383ff879222)
- Merge pull request 'Now base64-encoding the selfservice tokens👀' (#12) from bugfix/11-selfservice_profile_link into dev [`5ff6f77`](https://git.odit.services/lfk/mailer/commit/5ff6f77dafa6a3a67615fae6d228c31cb8eac6b9)
- Applied Docker MTU fix 🛠 [`f6c03c7`](https://git.odit.services/lfk/mailer/commit/f6c03c7ae218faf8bcdc4108e809ef121b87ef92)
- 🧾New changelog file version [CI SKIP] [skip ci] [`00e7837`](https://git.odit.services/lfk/mailer/commit/00e78371f3d875460596c24f3544d4e94a896f3c)
- Added tests [`91f9a8c`](https://git.odit.services/lfk/mailer/commit/91f9a8cbdecf74a74e68b80f3aec675de59e46d4)
- Added translation keys [`1d4d1d1`](https://git.odit.services/lfk/mailer/commit/1d4d1d18d85349b6f877fa5f1df82fe0d9dafe79)
- Sorted locales [`9ba4b40`](https://git.odit.services/lfk/mailer/commit/9ba4b4001d35afa49e4eb3232a21784ed443c52e)
- 📖New license file version [CI SKIP] [skip ci] [`ab0e41f`](https://git.odit.services/lfk/mailer/commit/ab0e41f73be5ad281d5909d6d8baa4dd882c7cc3)
- Updated ci with new kubernetes secrets 🚀🚀🚀 [`7842a3c`](https://git.odit.services/lfk/mailer/commit/7842a3c437a7d028df9e610257f7ccc0c3d8a871)
- Added new mailer function [`8da7c55`](https://git.odit.services/lfk/mailer/commit/8da7c55deb5c0b4fccb7f18688613d06dd92df45)
- Adjusted tests for mail types [`8271014`](https://git.odit.services/lfk/mailer/commit/8271014a101439ea46233099182eb78da9fdc11c)
- Added MailTypes to responses [`0fa94fc`](https://git.odit.services/lfk/mailer/commit/0fa94fc8679b45aa702068ad96097fe18b385a50)
- Revert "Now using more images powered by us 🚀🚀🚀" [`d5f2910`](https://git.odit.services/lfk/mailer/commit/d5f29108c479e641db91b2f48ab3cf5da16e9d14)
- Now using more images powered by us 🚀🚀🚀 [`c1d8b78`](https://git.odit.services/lfk/mailer/commit/c1d8b781a62ebedafa7f1fa598eab966e91d8b64)
- Added endpoint [`9807e61`](https://git.odit.services/lfk/mailer/commit/9807e61fa81a5790fc09f9920905c683ea1c3a79)
- 🧾New changelog file version [CI SKIP] [skip ci] [`07aeaf6`](https://git.odit.services/lfk/mailer/commit/07aeaf6d6ba46d0bde62141a7ab0f47c9afde565)
- 🧾New changelog file version [CI SKIP] [skip ci] [`416be79`](https://git.odit.services/lfk/mailer/commit/416be7920cc551bfd2da2ddfc2fdc25367cafc99)
- Added translation keys to txt [`44972e4`](https://git.odit.services/lfk/mailer/commit/44972e4a93204aa9f6acbbf29f3012aa8213af77)
- Changed ci pipeline type to kubernetes [`18c8600`](https://git.odit.services/lfk/mailer/commit/18c8600563c4369321a0e9ba51a09a2fa95198b5)
- Added new mailtype enum [`015b25a`](https://git.odit.services/lfk/mailer/commit/015b25a2056fe3537fb8e88539c25c2c9e6ba618)
- Dockerfile with cached images 🔥 [`f554718`](https://git.odit.services/lfk/mailer/commit/f55471825ef6833600780cb229148d7b7d122150)
- Now base64-encoding the selfservice tokens👀 [`1f58165`](https://git.odit.services/lfk/mailer/commit/1f581650c5164b6b6d6a6fce5e86e64074c1bdf9)
- Merge pull request 'Selfservice link forgotten mails feature/5-registration_forgot_mails' (#10) from feature/5-registration_forgot_mails into dev [`f011659`](https://git.odit.services/lfk/mailer/commit/f011659469bd62dffc17e440a6ed42d1fbe7956e)
- Fixed typo [`577f321`](https://git.odit.services/lfk/mailer/commit/577f321b3ffcea666eaaa529e86e532702432635)
- Renamed templates [`34e30d6`](https://git.odit.services/lfk/mailer/commit/34e30d64929ca7555cee62c4da86d07050b94ff5)
#### v0.1.0
> 4 March 2021
- Merge pull request 'Alpha release 0.1.0' (#9) from dev into main [`e60360c`](https://git.odit.services/lfk/mailer/commit/e60360ccd4f5d6d01b7f20b12e60edc4adb1f75d)
- 📖New license file version [CI SKIP] [skip ci] [`10b1312`](https://git.odit.services/lfk/mailer/commit/10b13127aa48f65641d1295b77556a6f74a94625)
- Added basic welcome mails [`b3f61f5`](https://git.odit.services/lfk/mailer/commit/b3f61f51e367c10e102e1d53e6c41c8280f6c0c3)
- 🚀Bumped version to v0.1.0 [`5e7cfff`](https://git.odit.services/lfk/mailer/commit/5e7cfff41eaf14bf17319319534c7713d9bbf3b9)
- Added drone file [`3f21503`](https://git.odit.services/lfk/mailer/commit/3f21503848b14c5f8f2066ab3fd8fe114bf1de41)
- 📖New license file version [CI SKIP] [skip ci] [`f11137e`](https://git.odit.services/lfk/mailer/commit/f11137e0c2140cd226d418c284387bc6a9532030)
- Added welcome mail tests [`ce87e1f`](https://git.odit.services/lfk/mailer/commit/ce87e1fc03340922c412a431d9595c740a78f42b)
- Added reset mail valid tests [`4624250`](https://git.odit.services/lfk/mailer/commit/46242509637e05e6b258b406d0a2a76e5db9ca03)
- Added all missing config vars/interpolations [`4994cb0`](https://git.odit.services/lfk/mailer/commit/4994cb0489b168ecc9f18103fdea5e578bb9ef74)
- Sorted translations [`1862013`](https://git.odit.services/lfk/mailer/commit/18620133b92baa81272ee084385129b2fb60d234)
- Added more info to the readme [`9cb100c`](https://git.odit.services/lfk/mailer/commit/9cb100c7c43b082263f4f58c82554c85d7be8494)
- Moved models to their own files [`9ce86eb`](https://git.odit.services/lfk/mailer/commit/9ce86ebef7d11ed0fb674dcf77f1b6dacd934aa4)
- Fixed typo [`4b5e24f`](https://git.odit.services/lfk/mailer/commit/4b5e24f3e30db94cf46d6d6362be519343c71a83)
- Added test mail tests [`bf9652d`](https://git.odit.services/lfk/mailer/commit/bf9652dcfed3667f9d2e8cfd933963935a621a88)
- Added + sorted translations [`6e99ad5`](https://git.odit.services/lfk/mailer/commit/6e99ad5c1ca3a4853a38acae6f0526c0fa54180c)
- Added german translations [`e2237d3`](https://git.odit.services/lfk/mailer/commit/e2237d34d39ccaef5600a6eb5d4c555531cb5941)
- Added jest config and first tests [`ec939e6`](https://git.odit.services/lfk/mailer/commit/ec939e6c1142e825cdb21555e03d9e026e7cdf3c)
- Added langauge keys for pw reset [`7595235`](https://git.odit.services/lfk/mailer/commit/7595235491694e95b11043f2d5e1fa20c65cd43c)
- Locales as enums [`d450ecb`](https://git.odit.services/lfk/mailer/commit/d450ecbf7cf8e0b97c46e1f1f57cfcd6f7c30dce)
- Added dockerfile and docker-compose [`c0c8046`](https://git.odit.services/lfk/mailer/commit/c0c8046031aeb19b3da5cd292316af54462c0978)
- Updated api doc tests to listen on the right endpoint [`f6a53cc`](https://git.odit.services/lfk/mailer/commit/f6a53cc3e47308e84cde13640cb3f614642fd4ca)
- Added drone pipeline for automagic tests [`3501a4b`](https://git.odit.services/lfk/mailer/commit/3501a4bef1b6ec73ea0be643e1b4e95ee9874ff9)
- Added env var docs to readme [`5314100`](https://git.odit.services/lfk/mailer/commit/5314100065f24cb0902c1ba207b880016abd300e)
- Added missing translations [`1ec95a1`](https://git.odit.services/lfk/mailer/commit/1ec95a1fda13bdfdc9c056a4f73578045c77d964)
- 📖New license file version [CI SKIP] [skip ci] [`4cde30e`](https://git.odit.services/lfk/mailer/commit/4cde30ef98370069dfad748e12bd720c1b84ad3e)
- Merge pull request 'Welcome mails feature/2-welcome_mails' (#7) from feature/2-welcome_mails into dev [`0b96dc8`](https://git.odit.services/lfk/mailer/commit/0b96dc8ba519b42922f1464853d694fc2984cbc0)
- Merge pull request 'Added real information to the README feature/3-readme' (#8) from feature/3-readme into dev [`aed676c`](https://git.odit.services/lfk/mailer/commit/aed676c04b6223916b638340b04677fc34c5b6ae)
- Added registration mail endpoint [`b3952c3`](https://git.odit.services/lfk/mailer/commit/b3952c39e5f52412c955d6a9cb96f81396e06d82)
- Added request class [`056b74c`](https://git.odit.services/lfk/mailer/commit/056b74ce2268185d39554a7d7afeaaf75c4e17a2)
- Added reset mail request model [`5812a48`](https://git.odit.services/lfk/mailer/commit/5812a485ee2e23e8d0bb15bedbebdf7734817865)
- Now accepting reset mail class [`7445223`](https://git.odit.services/lfk/mailer/commit/7445223f1e6782536157d09cddcad9c942b72e7d)
- Added ci status [`e48f830`](https://git.odit.services/lfk/mailer/commit/e48f830c08900a9c9e4451d16a25f3ef3d9485e4)
- Merge pull request 'Added tests for the mail endpoints feature/4-tests' (#6) from feature/4-tests into dev [`7473931`](https://git.odit.services/lfk/mailer/commit/7473931f2705bbdff7a15b74f8d1f39228694697)
- Merge pull request 'Initial release 0.0.1' (#1) from dev into main [`1d3901a`](https://git.odit.services/lfk/mailer/commit/1d3901ae8f9a0c4675cacd7d0c44c547a06985d4)
- Added basic loaders/files/dirs [`4e80aa8`](https://git.odit.services/lfk/mailer/commit/4e80aa8a32911ca9697e411f82e8923977ae8216)
- Added the old mail templates [`c5f2532`](https://git.odit.services/lfk/mailer/commit/c5f2532504768ee26c170e4f4d84bc25a87c63cc)
- Initial commit [`907b989`](https://git.odit.services/lfk/mailer/commit/907b989d534dab098cc6013f5954203bc9a37510)
- Added language keys for test mails [`8ab80fd`](https://git.odit.services/lfk/mailer/commit/8ab80fd7ed19f90c51a3f15f90d23e33c451df8e)
- Added basic files and depedencies [`4e5d5ae`](https://git.odit.services/lfk/mailer/commit/4e5d5ae31171a9b60e684694e04b840a92abbe50)
- Added basic mailer that can send pw reset mails [`279a9ca`](https://git.odit.services/lfk/mailer/commit/279a9ca946ec028e7003df4f3f78ce80f5e455b4)
- Added basic config [`9c2f465`](https://git.odit.services/lfk/mailer/commit/9c2f465b99b8610047b5f5b4b8d6707e6d6ee8bd)
- Now generateing api key via eng_gen script [`17f5876`](https://git.odit.services/lfk/mailer/commit/17f5876d738bcc461f7b4fac907cb8bb9bc13aa5)
- Added function for sending test mail [`602600d`](https://git.odit.services/lfk/mailer/commit/602600db895a01ca72182e3e2d6094a5e20d4b85)
- Added basic apispec generator [`124c7a5`](https://git.odit.services/lfk/mailer/commit/124c7a5d1544686dc4fd6e2eaf50e519c2fe0a49)
- Added app startup file [`53daae9`](https://git.odit.services/lfk/mailer/commit/53daae956da47008312e45a49d445f5674c33551)
- Added basic mail controller [`972b09d`](https://git.odit.services/lfk/mailer/commit/972b09d8ca4cf250e308340a4ba59f741de77801)
- Added ans sorted translations [`3f5b77d`](https://git.odit.services/lfk/mailer/commit/3f5b77dc8e085fc25b4b5cc9ffa054ee8ec5bd6b)
- Added the usual middlewares [`e0523db`](https://git.odit.services/lfk/mailer/commit/e0523db739f772166c0bf895d0d40435848f4600)
- Added function for generateing test envs [`fc37d14`](https://git.odit.services/lfk/mailer/commit/fc37d146209f6561cc1642774f1ef3a9cadb39f8)
- Added ans sorted translations [`aedcbd5`](https://git.odit.services/lfk/mailer/commit/aedcbd5f56692c522c356c9c05cd6b5e13c87b3a)
- Sorted translations [`a84500c`](https://git.odit.services/lfk/mailer/commit/a84500ca1b240c72a69d47f9b35adea7a288c23a)
- Added success response [`895e346`](https://git.odit.services/lfk/mailer/commit/895e346e599a93ac32c90318197a890fd0599513)
- Added status controller [`aa28601`](https://git.odit.services/lfk/mailer/commit/aa286013a146fe2ad11c1601bef529ad956a9fed)
- Fixed broken formatting [`dc3bab3`](https://git.odit.services/lfk/mailer/commit/dc3bab324704005490aaffcd62f18e660c4315c8)
- Added mail errors [`c5fe167`](https://git.odit.services/lfk/mailer/commit/c5fe1671a2e1325740a29c93f2fe2dbb76579391)
- Added basic jest packages and scripts [`fa9d0e5`](https://git.odit.services/lfk/mailer/commit/fa9d0e5790a6d7ba9d4490bc016e0f9afde49ec8)
- Updated comments [`d77670f`](https://git.odit.services/lfk/mailer/commit/d77670fb7023aae86b7039684a6b059ee91bf17d)
- Added custom i18n ally framework [`264af07`](https://git.odit.services/lfk/mailer/commit/264af075f306675e4247fbcadebfcdab8fa0ba3b)
- Added stuff to gitignore [`21fab5d`](https://git.odit.services/lfk/mailer/commit/21fab5d53a7f228fa4ef64e53c64fe5324b0ec17)
- Fixed json [`a1fbabd`](https://git.odit.services/lfk/mailer/commit/a1fbabdee8f414498c5efd95d5d87f41ef3cc28e)
- 🧾New changelog file version [CI SKIP] [skip ci] [`7c16dd1`](https://git.odit.services/lfk/mailer/commit/7c16dd1b447369c87f2e3a487ec2a3f1fc8451c5)
- Disabled html autoformatting [`6c5996e`](https://git.odit.services/lfk/mailer/commit/6c5996e1e514ad9b2294316088c34e44255ae895)
- Added nodemailer dependencies [`87d7175`](https://git.odit.services/lfk/mailer/commit/87d7175f962e8810c98fc72a9bb0fc19ef9e2c22)
- Added initial translation [`48aa076`](https://git.odit.services/lfk/mailer/commit/48aa076e08b7c32bf53b86c942b129d7f366d93b)
- Updated consola [`9323cec`](https://git.odit.services/lfk/mailer/commit/9323cecf944dde0b5c187059ded0fe576a0e6758)
- Added eventname to config [`a62f9c6`](https://git.odit.services/lfk/mailer/commit/a62f9c683dd09303af47e2ed4e8df60bb2df3121)
- Added test watch mode [`38cffc2`](https://git.odit.services/lfk/mailer/commit/38cffc20490fe10b4e4bc4d88a8377562cd1545a)
- Added email address verification [`9b5c0b8`](https://git.odit.services/lfk/mailer/commit/9b5c0b8f0630ddaeb78e0d319692985d91a6db76)
- Fixed argument bug [`6a803c0`](https://git.odit.services/lfk/mailer/commit/6a803c04ab2065db60a13b1aa3333fdfe252f1ab)
- Added env generation script [`01f5001`](https://git.odit.services/lfk/mailer/commit/01f500135518a628cca9f2a51e25f9ef94b99fa2)
- Not ignoring i18n ally framework any more [`92494ea`](https://git.odit.services/lfk/mailer/commit/92494eaf6cea490a2c87ebc8f4d14e52d7d9ed0c)
- Added copyright owner to config [`806cc81`](https://git.odit.services/lfk/mailer/commit/806cc814c39fbe9e09eda87660e076eade1c8b01)
- Adjusted mail title [`314ceac`](https://git.odit.services/lfk/mailer/commit/314ceaca9d1ff8423c027a9457e6c8d8520272a4)
- Fixed inerpolation [`f8b9b18`](https://git.odit.services/lfk/mailer/commit/f8b9b188ae47adbc2a11a68274e9d2db3eb6b692)
- Changed wording [`940acab`](https://git.odit.services/lfk/mailer/commit/940acab77015eced94e5273d4d0a824653665098)
- Updated interpolations [`0926f31`](https://git.odit.services/lfk/mailer/commit/0926f31fac183a7064aac1679babc57f3b3681c8)
- Added empty locale files [`0438df3`](https://git.odit.services/lfk/mailer/commit/0438df3bd18c4c424d0db4c269f3ce9f40eb97e5)
- Removed eventname from config [`691d61b`](https://git.odit.services/lfk/mailer/commit/691d61bd3c40ded3d617a8569dab51e7728ee8ce)
- Added eventname to config [`9bdb307`](https://git.odit.services/lfk/mailer/commit/9bdb3072aa318f5621443b839c6d1067d80b3580)
- Moved scripts to own scripts folder [`22195c1`](https://git.odit.services/lfk/mailer/commit/22195c11dd825f83d8415445e2ee82aaa53a83cd)

View File

@ -1,5 +1,5 @@
# Typescript Build
FROM registry.odit.services/mirror/node:14.15.1-alpine3.12
FROM registry.odit.services/hub/library/node:14.15.1-alpine3.12
WORKDIR /app
COPY package.json ./
RUN npm i -g pnpm
@ -8,7 +8,7 @@ COPY tsconfig.json ./
COPY src ./src
RUN pnpm run build
# final image
FROM registry.odit.services/mirror/node:14.15.1-alpine3.12
FROM registry.odit.services/hub/library/node:14.15.1-alpine3.12
COPY package.json ./
RUN npm i -g pnpm
RUN pnpm i --prod

View File

@ -494,7 +494,7 @@ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## License Text
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,6 @@
{
"name": "@odit/lfk-mailer",
"version": "0.1.0",
"version": "0.1.1",
"description": "The document mailer for the LfK! runner system. This generates and sends mails (password reset, welcome, ...)",
"main": "src/app.ts",
"scripts": {

View File

@ -121,11 +121,12 @@ export class Mailer {
/**
* Function for sending a reset mail from the reset mail template.
* @param to_address The address the mail will be sent to. Should always get pulled from a user object.
* @param token The requested password reset token - will be combined with the app_url to generate a password reset link.
* @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
* @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
*/
public async sendWelcomeMail(to_address: string, token: string, locale: string = "en") {
await i18next.changeLanguage(locale);
token = Buffer.from(token).toString("base64");
const replacements = {
recipient_mail: to_address,
@ -152,6 +153,40 @@ export class Mailer {
await this.sendMail(mail);
}
/**
* Function for sending a selfservice link forgotten mail from the runner_forgot template.
* @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
* @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
*/
public async sendSelfserviceForgottenMail(to_address: string, token: string, locale: string = "en") {
await i18next.changeLanguage(locale);
token = Buffer.from(token).toString("base64");
const replacements = {
recipient_mail: to_address,
copyright_owner: config.copyright_owner,
link_imprint: `${config.app_url}/imprint`,
link_privacy: `${config.app_url}/privacy`,
selfservice_link: `${config.app_url}/selfservice/profile/${token}`,
forgot_link: `${config.app_url}/selfservice`,
contact_mail: config.contact_mail,
event_name: config.event_name
}
const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.html', { encoding: 'utf8' }));
const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.txt', { encoding: 'utf8' }));
const body_html = template_html(replacements);
const body_txt = template_txt(replacements);
const mail: MailOptions = {
to: to_address,
subject: i18next.t("your-event_name-profile", Mailer.interpolations).toString(),
text: body_txt,
html: body_html
};
await this.sendMail(mail);
}
/**
* Wrapper function for sending a mail via this object's transporter.
* @param mail MailOptions object containing the

View File

@ -2,6 +2,7 @@ import { Authorized, Body, JsonController, Post, QueryParam } from 'routing-cont
import { OpenAPI } from 'routing-controllers-openapi';
import { Mailer } from '../Mailer';
import { locales } from '../models/LocaleEnum';
import { MailTypes } from '../models/MailTypeEnum';
import { ResetMail } from '../models/ResetMail';
import { SuccessResponse } from '../models/SuccessResponse';
import { WelcomeMail } from '../models/WelcomeMail';
@ -28,7 +29,7 @@ export class MailController {
} catch (error) {
throw error;
}
return new SuccessResponse(locale);
return new SuccessResponse(MailTypes.PASSWORD_RESET, locale);
}
@Post('/test')
@ -44,7 +45,7 @@ export class MailController {
console.log(error)
throw error;
}
return new SuccessResponse(locale);
return new SuccessResponse(MailTypes.TEST, locale);
}
@Post('/registration')
@ -60,6 +61,22 @@ export class MailController {
console.log(error)
throw error;
}
return new SuccessResponse(locale);
return new SuccessResponse(MailTypes.RUNNER_WELCOME, locale);
}
@Post('/registration_forgot')
@OpenAPI({ description: "Sends selfservice link forgotten mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
async sendSelfserviceForgotten(@Body({ validate: true }) mailOptions: WelcomeMail, @QueryParam("locale") locale: locales) {
if (!this.initialized) {
await this.mailer.init();
this.initialized = true;
}
try {
this.mailer.sendSelfserviceForgottenMail(mailOptions.address, mailOptions.selfserviceToken, locale?.toString())
} catch (error) {
console.log(error)
throw error;
}
return new SuccessResponse(MailTypes.RUNNER_FORGOT, locale);
}
}

View File

@ -12,15 +12,20 @@
"privacy": "Privacy",
"reset-password": "Reset password",
"test-mail": "Test mail",
"thank-you-for-requesting-a-new-link-to-your-event_name-runner-profile": "Thank you for requesting a new link to your {{event_name}} runner profile.",
"thanks-for-registering-and-welcome-to-the-event_name": "Thanks for registering and welcome to the {{event_name}}!",
"the-only-thing-you-have-to-do-now-is-to-bring-your-registration-code-with-you": "The only thing you have to do now is to bring your registration code with you.",
"this-is-a-test-mail-triggered-by-an-admin-in-the-lfk-backend": "This is a test mail triggered by an admin in the LfK! backend.",
"this-mail-was-sent-to-recipient_mail-because-someone-request-a-mail-test-for-this-mail-address": "This mail was sent to you because someone request a mail test for this mail address.",
"this-mail-was-sent-to-you-because-someone-request-a-password-reset-for-a-account-linked-to-the-mail-address": "This mail was sent to you because someone request a password reset for a account linked to the mail address.",
"this-mail-was-sent-to-you-because-someone-used-your-mail-address-to-register-themselfes-for-the-event_name": "This mail was sent to you, because someone used your mail address to register themselfes for the {{event_name}}",
"this-mail-was-sent-to-you-because-someone-requested-a-new-link-to-access-your-profile-for-the-event_name": "This mail was sent to you, because someone requested a new link to access your profile for the {{event_name}}.",
"this-mail-was-sent-to-you-because-someone-used-your-mail-address-to-register-themselfes-for-the-event_name": "This mail was sent to you, because someone used your mail address to register themselves for the {{event_name}}",
"to-prevent-spam-you-can-only-request-a-new-link-every-24hrs": "To prevent spam you can only request a new link every 24hrs.",
"view-my-data": "View my data",
"we-successfully-processed-your-registration": "We successfully processed your registration.",
"welcome": "Welcome",
"you-can-view-your-registration-code-lap-times-and-much-more-by-visiting-our-selfservice": "You can view your registration code, lap times and much more by visiting our selfservice:",
"your-password-wont-be-changed-until-you-click-the-reset-link-below-and-set-a-new-one": "Your password won't be changed until you click the reset link below and set a new one."
"your-event_name-profile": "Your {{event_name}} profile",
"your-password-wont-be-changed-until-you-click-the-reset-link-below-and-set-a-new-one": "Your password won't be changed until you click the reset link below and set a new one.",
"your-profile": "Your Profile"
}

View File

@ -0,0 +1,6 @@
export enum MailTypes {
PASSWORD_RESET = "PASSWORD_RESET",
RUNNER_FORGOT = "RUNNER_FORGOT",
RUNNER_WELCOME = "RUNNER_WELCOME",
TEST = "TEST"
}

View File

@ -1,5 +1,6 @@
import { IsBoolean, IsString } from 'class-validator';
import { locales } from './LocaleEnum';
import { MailTypes } from './MailTypeEnum';
/**
* Simple success response class to make everyone happy :)
@ -15,7 +16,11 @@ export class SuccessResponse {
@IsString()
locale: locales;
constructor(locale?: locales) {
@IsString()
type: MailTypes;
constructor(type: MailTypes, locale?: locales) {
this.type = type;
this.locale = locale || locales.en;
}
}

View File

@ -0,0 +1,396 @@
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>{{__ "your-event_name-profile"}}<title> <!-- The title tag shows in email notifications, like Android 4.4. -->
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely -->
<meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no"> <!-- Tell iOS not to automatically link certain text strings. -->
<!-- CSS Reset : BEGIN -->
<style>
/* What it does: Remove spaces around the email design added by some email clients. */
/* Beware: It can remove the padding / margin and add a background color to the compose a reply window. */
html,
body {
margin: 0 auto !important;
padding: 0 !important;
height: 100% !important;
width: 100% !important;
}
/* What it does: Stops email clients resizing small text. */
* {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
/* What it does: Centers email on Android 4.4 */
div[style*="margin: 16px 0"] {
margin:0 !important;
}
/* What it does: Stops Outlook from adding extra spacing to tables. */
table,
td {
mso-table-lspace: 0pt !important;
mso-table-rspace: 0pt !important;
}
/* What it does: Fixes webkit padding issue. */
table {
border: 0;
border-spacing: 0;
border-collapse: collapse
}
/* What it does: Forces Samsung Android mail clients to use the entire viewport. */
#MessageViewBody,
#MessageWebViewDiv{
width: 100% !important;
}
/* What it does: Uses a better rendering method when resizing images in IE. */
img {
-ms-interpolation-mode:bicubic;
}
/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
a {
text-decoration: none;
}
/* What it does: A work-around for email clients automatically linking certain text strings. */
/* iOS */
a[x-apple-data-detectors],
.unstyle-auto-detected-links a,
.aBn {
border-bottom: 0 !important;
cursor: default !important;
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
u + #body a, /* Gmail */
#MessageViewBody a /* Samsung Mail */
{
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
/* What it does: Prevents Gmail from changing the text color in conversation threads. */
.im {
color: inherit !important;
}
/* What it does: Prevents Gmail from displaying an download button on large, non-linked images. */
.a6S {
display: none !important;
opacity: 0.01 !important;
}
/* If the above doesn't work, add a .g-img class to any image in question. */
img.g-img + div {
display:none !important;
}
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
/* Create one of these media queries for each additional viewport size you'd like to fix */
/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
@media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
u ~ div .email-container {
min-width: 320px !important;
}
}
/* iPhone 6, 6S, 7, 8, and X */
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
u ~ div .email-container {
min-width: 375px !important;
}
}
/* iPhone 6+, 7+, and 8+ */
@media only screen and (min-device-width: 414px) {
u ~ div .email-container {
min-width: 414px !important;
}
}
</style>
<!-- What it does: Helps DPI scaling in Outlook 2007-2013 -->
<!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<!-- CSS Reset : END -->
<!-- Progressive Enhancements : BEGIN -->
<style>
/* What it does: Hover styles for buttons and tags */
.s-btn__primary:hover {
background: #0077CC !important;
border-color: #0077CC !important;
}
.s-btn__white:hover {
background: #EFF0F1 !important;
border-color: #EFF0F1 !important;
}
.s-btn__outlined:hover {
background: rgba(0,119,204,.05) !important;
color: #005999 !important;
}
.s-tag:hover,
.post-tag:hover {
border-color: #cee0ed !important;
background: #cee0ed !important;
}
/* What it does: Styles markdown links that we can't write inline CSS for. */
.has-markdown a,
.has-markdown a:visited {
color: #0077CC !important;
text-decoration: none !important;
}
/* What it does: Styles markdown code blocks that we can't write inline CSS for. */
code {
padding: 1px 5px;
background-color: #EFF0F1;
color: #242729;
font-size: 13px;
line-height: inherit;
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif;
}
pre {
margin: 0 0 15px;
line-height: 17px;
background-color: #EFF0F1;
padding: 4px 8px;
border-radius: 3px;
overflow-x: auto;
}
pre code {
margin: 0 0 15px;
padding: 0;
line-height: 17px;
background-color: none;
}
/* What it does: Styles markdown blockquotes that we can't write inline CSS for. */
blockquote {
margin: 0 0 15px;
padding: 4px 10px;
background-color: #FFF8DC;
border-left: 2px solid #ffeb8e;
}
blockquote p {
padding: 4px 0;
margin: 0;
overflow-wrap: break-word;
}
/* What it does: Rounds corners in email clients that support it */
.bar {
border-radius: 5px;
}
.btr {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.bbr {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
@media screen and (max-width: 680px) {
/* What it does: Forces table cells into full-width rows. */
.stack-column,
.stack-column-center {
display: block !important;
width: 100% !important;
max-width: 100% !important;
direction: ltr !important;
}
/* And center justify these ones. */
.stack-column-center {
text-align: center !important;
}
/* Hides things in small viewports. */
.hide-on-mobile {
display: none !important;
max-height: 0 !important;
overflow: hidden !important;
visibility: hidden !important;
}
/* What it does: Utility classes to reduce spacing for smaller viewports. */
.sm-p-none {padding: 0 !important;}
.sm-pt-none {padding-top: 0 !important;}
.sm-pb-none {padding-bottom: 0 !important;}
.sm-pr-none {padding-right: 0 !important;}
.sm-pl-none {padding-left: 0 !important;}
.sm-px-none {padding-left: 0 !important; padding-right: 0 !important;}
.sm-py-none {padding-top: 0 !important; padding-bottom: 0 !important;}
.sm-p {padding: 20px !important;}
.sm-pt {padding-top: 20px !important;}
.sm-pb {padding-bottom: 20px !important;}
.sm-pr {padding-right: 20px !important;}
.sm-pl {padding-left: 20px !important;}
.sm-px {padding-left: 20px !important; padding-right: 20px !important;}
.sm-py {padding-top: 20px !important; padding-bottom: 20px !important;}
.sm-mb {margin-bottom: 20px !important;}
/* What it does: Utility classes to kill border radius for smaller viewports. Used mainly on the email's main container(s). */
.bar,
.btr,
.bbr {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
}
</style>
<!-- Progressive Enhancements : END -->
</head>
<!--
The email background color is defined in three places, just below. If you change one, remember to change the others.
1. body tag: for most email clients
2. center tag: for Gmail and Inbox mobile apps and web versions of Gmail, GSuite, Inbox, Yahoo, AOL, Libero, Comcast, freenet, Mail.ru, Orange.fr
3. mso conditional: For Windows 10 Mail
-->
<body width="100%" style="margin: 0; padding: 0 !important; background: #f3f3f5; mso-line-height-rule: exactly;">
<center style="width: 100%; background: #f3f3f5;">
<!--[if mso | IE]>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: #f3f3f5;">
<tr>
<td>
<![endif]-->
<!-- Visually Hidden Preview Text : BEGIN -->
<div style="display: none; font-size: 1px; line-height: 1px; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all; font-family: sans-serif;">
{{__ "your-event_name-profile"}}
</div>
<!-- Visually Hidden Preview Text : END -->
<div class="email-container" style="max-width: 680px; margin: 0 auto;">
<!--[if mso]>
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center">
<tr>
<td>
<![endif]-->
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="max-width: 680px; width:100%">
<tr>
<td style="padding: 30px; background-color: #ffffff;" class="sm-p bar">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
<tr>
<td style="padding-bottom: 15px; font-family: arial, sans-serif; font-size: 15px; line-height: 21px; color: #3C3F44; text-align: left;">
<h1 style="font-weight: bold; font-size: 27px; line-height: 27px; color: #0C0D0E; margin: 0 0 15px 0;">{{event_name}}</h1>
</td>
</tr>
<tr>
<td style="padding-bottom: 15px; font-family: arial, sans-serif; font-size: 15px; line-height: 21px; color: #3C3F44; text-align: left;">
<h1 style="font-weight: bold; font-size: 21px; line-height: 21px; color: #0C0D0E; margin: 0 0 15px 0;">{{__ "your-profile"}}</h1>
<p style="margin: 0 0 15px;" class="has-markdown">
{{__ "thank-you-for-requesting-a-new-link-to-your-event_name-runner-profile"}}<br>
{{__ "you-can-view-your-registration-code-lap-times-and-much-more-by-visiting-our-selfservice"}}
</p>
</td>
</tr>
<!-- Button Row : BEGIN -->
<tr>
<td>
<!-- Button : BEGIN -->
<table align="left" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td class="s-btn s-btn__primary" style="border-radius: 4px; background: #0095ff;">
<a class="s-btn s-btn__primary" href="{{selfservice_link}}" target="_parent" style="background: #0095FF; border: 1px solid #0077cc; box-shadow: inset 0 1px 0 0 rgba(102,191,255,.75); font-family: arial, sans-serif; font-size: 17px; line-height: 17px; color: #ffffff; text-align: center; text-decoration: none; padding: 13px 17px; display: block; border-radius: 4px; white-space: nowrap;">{{__ "view-my-data"}}</a>
</td>
</tr>
</table>
<!-- Button : END -->
</td>
</tr>
<tr>
<td style="padding-bottom: 15px; font-family: arial, sans-serif; font-size: 15px; line-height: 21px; color: #3C3F44; text-align: left;">
<p>Link: <a href="{{selfservice_link}}">{{selfservice_link}}</a><br>
{{__ "if-you-ever-loose-the-link-you-can-request-a-new-one-by-visiting-our-website"}} <a href="{{forgot_link}}">{{forgot_link}}</a></p></td>
</tr>
<!-- Button Row : END -->
</table>
</td>
</tr>
<!-----------------------------
EMAIL BODY : END
------------------------------>
<!-- Footer : BEGIN -->
<tr>
<td style="padding: 30px;" class="sm-p">
<table align="left" border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<!-- Subscription Info : BEGIN -->
<tr>
<td style="padding-bottom: 10px; font-size: 12px; line-height: 15px; font-family: arial, sans-serif; color: #9199A1; text-align: left;">
Copyright © {{copyright_owner}}. {{__ "all-rights-reserved"}}
</td>
</tr>
<tr>
<td style="font-size: 12px; line-height: 15px; font-family: arial, sans-serif; color: #9199A1; text-align: left;">
<a href="{{link_imprint}}"
style="color: #9199A1; text-decoration: underline;">{{__ "imprint"}}</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{link_privacy}}" style="color: #9199A1; text-decoration: underline;">{{__ "privacy"}}</a>
</td>
</tr>
<!-- Subscription Info : BEGIN -->
<!-- HR line : BEGIN -->
<tr>
<td style="padding: 30px 0;" width="100%" class="sm-py">
<table aria-hidden="true" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%">
<tr>
<td height="1" width="100%" style="font-size: 0; line-height: 0; border-top: 1px solid #D6D8DB;">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<!-- HR line : END -->
<tr>
<td style="padding-bottom: 5px; font-size: 12px; line-height: 15px; font-family: arial, sans-serif; color: #9199A1; text-align: left;">
{{__ "this-mail-was-sent-to-you-because-someone-requested-a-new-link-to-access-your-profile-for-the-event_name"}}<br>
{{__ "to-prevent-spam-you-can-only-request-a-new-link-every-24hrs"}}<br>
{{__ "if-you-didnt-register-yourself-you-should-contact-us-to-get-your-data-removed-from-our-systems"}} <a href="mailto:{{contact_mail}}">{{contact_mail}}</a>
</td>
</tr>
<!-- Sender Info : END -->
</table>
</td>
</tr>
<!-- Footer : END -->
</table>
</div>
<!--[if mso | IE]>
</td>
</tr>
</table>
<![endif]-->
</center>
</body>
</html>

View File

@ -0,0 +1,15 @@
{{__ "your-event_name-profile"}}
{{__ "thank-you-for-requesting-a-new-link-to-your-event_name-runner-profile"}}
{{__ "you-can-view-your-registration-code-lap-times-and-much-more-by-visiting-our-selfservice"}}
{{selfservice_link}}
{{__ "if-you-ever-loose-the-link-you-can-request-a-new-one-by-visiting-our-website"}} {{forgot_link}}
Copyright © {{copyright_owner}}. {{__ "all-rights-reserved"}}.
{{__ "imprint"}}: {{link_imprint}} | {{__ "privacy"}}: {{link_privacy}}
{{__ "this-mail-was-sent-to-you-because-someone-requested-a-new-link-to-access-your-profile-for-the-event_name"}}
{{__ "to-prevent-spam-you-can-only-request-a-new-link-every-24hrs"}}
{{__ "if-you-didnt-register-yourself-you-should-contact-us-to-get-your-data-removed-from-our-systems"}} {{contact_mail}}

View File

@ -42,7 +42,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "PASSWORD_RESET"
})
});
it('Post with auth, body and locale=en should return 200', async () => {
@ -54,7 +55,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "PASSWORD_RESET"
})
});
it('Post with auth, body and locale=de should return 200', async () => {
@ -66,7 +68,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "de"
locale: "de",
type: "PASSWORD_RESET"
})
});
});

View File

@ -0,0 +1,75 @@
import axios from 'axios';
import { config } from '../config';
const base = "http://localhost:" + config.internal_port
const axios_config = {
validateStatus: undefined
};
describe('POST /registration_forgot without auth', () => {
it('Post without auth should return 401', async () => {
const res = await axios.post(base + '/registration_forgot', null, axios_config);
expect(res.status).toEqual(401);
});
});
describe('POST /registration_forgot with auth but wrong body', () => {
it('Post with auth but no body should return 400', async () => {
const res = await axios.post(base + '/registration_forgot?key=' + config.api_key, null, axios_config);
expect(res.status).toEqual(400);
});
it('Post with auth but no mail should return 400', async () => {
const res = await axios.post(base + '/registration_forgot?key=' + config.api_key, { selfserviceToken: "test" }, axios_config);
expect(res.status).toEqual(400);
});
it('Post with auth but no reset key should return 400', async () => {
const res = await axios.post(base + '/registration_forgot?key=' + config.api_key, { address: "test@dev.lauf-fuer-kaya.de" }, axios_config);
expect(res.status).toEqual(400);
});
it('Post with auth but invalid mail should return 400', async () => {
const res = await axios.post(base + '/registration_forgot?key=' + config.api_key, { selfserviceToken: "test", address: "testdev.l.de" }, axios_config);
expect(res.status).toEqual(400);
});
});
describe('POST /reset with auth and vaild body', () => {
it('Post with auth, body and no locale should return 200', async () => {
const res = await axios.post(base + '/registration_forgot?key=' + config.api_key, {
selfserviceToken: "test",
address: "test@dev.lauf-fuer-kaya.de"
}, axios_config);
expect(res.status).toEqual(200);
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en",
type: "RUNNER_FORGOT"
})
});
it('Post with auth, body and locale=en should return 200', async () => {
const res = await axios.post(base + '/registration_forgot?locale=en&key=' + config.api_key, {
selfserviceToken: "test",
address: "test@dev.lauf-fuer-kaya.de"
}, axios_config);
expect(res.status).toEqual(200);
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en",
type: "RUNNER_FORGOT"
})
});
it('Post with auth, body and locale=de should return 200', async () => {
const res = await axios.post(base + '/registration_forgot?locale=de&key=' + config.api_key, {
selfserviceToken: "test",
address: "test@dev.lauf-fuer-kaya.de"
}, axios_config);
expect(res.status).toEqual(200);
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "de",
type: "RUNNER_FORGOT"
})
});
});

View File

@ -42,7 +42,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "RUNNER_WELCOME"
})
});
it('Post with auth, body and locale=en should return 200', async () => {
@ -54,7 +55,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "RUNNER_WELCOME"
})
});
it('Post with auth, body and locale=de should return 200', async () => {
@ -66,7 +68,8 @@ describe('POST /reset with auth and vaild body', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "de"
locale: "de",
type: "RUNNER_WELCOME"
})
});
});

View File

@ -20,7 +20,8 @@ describe('POST /test with auth', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "TEST"
})
});
it('Post with auth and locale=en should return 200', async () => {
@ -29,7 +30,8 @@ describe('POST /test with auth', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "en"
locale: "en",
type: "TEST"
})
});
it('Post with auth and locale=de should return 200', async () => {
@ -38,7 +40,8 @@ describe('POST /test with auth', () => {
expect(res.data).toEqual({
success: true,
message: "Sent!",
locale: "de"
locale: "de",
type: "TEST"
})
});
});