Now accepting reset mail class
This commit is contained in:
parent
5812a485ee
commit
7445223f1e
|
@ -1,7 +1,8 @@
|
|||
import { Authorized, JsonController, Post, QueryParam } from 'routing-controllers';
|
||||
import { Authorized, Body, JsonController, Post, QueryParam } from 'routing-controllers';
|
||||
import { OpenAPI } from 'routing-controllers-openapi';
|
||||
import { Mailer } from '../Mailer';
|
||||
import { locales } from '../models/LocaleEnum';
|
||||
import { ResetMail } from '../models/ResetMail';
|
||||
import { SuccessResponse } from '../models/SuccessResponse';
|
||||
|
||||
/**
|
||||
|
@ -16,13 +17,13 @@ export class MailController {
|
|||
|
||||
@Post('/reset')
|
||||
@OpenAPI({ description: "Sends reset mails", parameters: [{ in: "query", name: "locale", schema: { type: "string", enum: ["de", "en"] } }] })
|
||||
async sendReset(@QueryParam("locale") locale: locales) {
|
||||
async sendReset(@Body({ validate: true }) mailOptions: ResetMail, @QueryParam("locale") locale: locales) {
|
||||
if (!this.initialized) {
|
||||
await this.mailer.init();
|
||||
this.initialized = true;
|
||||
}
|
||||
try {
|
||||
this.mailer.sendResetMail("todo", "lelele", locale?.toString())
|
||||
this.mailer.sendResetMail(mailOptions.address, mailOptions.resetKey, locale?.toString())
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ export class ResetMail {
|
|||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
toAddress: string;
|
||||
address: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
resetLink: string;
|
||||
resetKey: string;
|
||||
}
|
Loading…
Reference in New Issue