Compare commits
3 Commits
1551a444ba
...
9a1678acf0
Author | SHA1 | Date | |
---|---|---|---|
9a1678acf0 | |||
485c247cd3 | |||
ddea02db57 |
@ -13,7 +13,9 @@ export const config = {
|
|||||||
seedTestData: getDataSeeding(),
|
seedTestData: getDataSeeding(),
|
||||||
app_url: process.env.APP_URL || "http://localhost:8080",
|
app_url: process.env.APP_URL || "http://localhost:8080",
|
||||||
privacy_url: process.env.PRIVACY_URL || "/privacy",
|
privacy_url: process.env.PRIVACY_URL || "/privacy",
|
||||||
imprint_url: process.env.IMPRINT_URL || "/imprint"
|
imprint_url: process.env.IMPRINT_URL || "/imprint",
|
||||||
|
mailer_url: process.env.MAILER_URL || "http://localhost:8080/mailer",
|
||||||
|
mailer_key: process.env.MAILER_KEY || "pleasesetme"
|
||||||
}
|
}
|
||||||
let errors = 0
|
let errors = 0
|
||||||
if (typeof config.internal_port !== "number") {
|
if (typeof config.internal_port !== "number") {
|
||||||
|
@ -15,12 +15,6 @@ import { Logout } from '../models/responses/ResponseLogout';
|
|||||||
@JsonController('/auth')
|
@JsonController('/auth')
|
||||||
export class AuthController {
|
export class AuthController {
|
||||||
|
|
||||||
private mailer: Mailer;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.mailer = new Mailer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Post("/login")
|
@Post("/login")
|
||||||
@ResponseSchema(ResponseAuth)
|
@ResponseSchema(ResponseAuth)
|
||||||
@ResponseSchema(InvalidCredentialsError)
|
@ResponseSchema(InvalidCredentialsError)
|
||||||
@ -94,7 +88,7 @@ export class AuthController {
|
|||||||
@OpenAPI({ description: "Request a password reset token. <br> This will provide you with a reset token that you can use by posting to /api/auth/reset/{token}." })
|
@OpenAPI({ description: "Request a password reset token. <br> This will provide you with a reset token that you can use by posting to /api/auth/reset/{token}." })
|
||||||
async getResetToken(@Body({ validate: true }) passwordReset: CreateResetToken) {
|
async getResetToken(@Body({ validate: true }) passwordReset: CreateResetToken) {
|
||||||
const reset_token: string = await passwordReset.toResetToken();
|
const reset_token: string = await passwordReset.toResetToken();
|
||||||
await this.mailer.sendResetMail(passwordReset.email, reset_token);
|
await Mailer.sendResetMail(passwordReset.email, reset_token);
|
||||||
return new ResponseEmpty();
|
return new ResponseEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import { Authorized, JsonController, Post } from 'routing-controllers';
|
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
|
||||||
import { config } from '../config';
|
|
||||||
import { Mailer } from '../mailer';
|
|
||||||
import { ResponseEmpty } from '../models/responses/ResponseEmpty';
|
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/mails')
|
|
||||||
@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
|
||||||
export class MailController {
|
|
||||||
|
|
||||||
private mailer: Mailer;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.mailer = new Mailer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Post('/test')
|
|
||||||
@Authorized(["MAIL:CREATE"])
|
|
||||||
@ResponseSchema(ResponseEmpty, { statusCode: 200 })
|
|
||||||
@OpenAPI({ description: 'Sends a test email to the configured from-address.' })
|
|
||||||
async get() {
|
|
||||||
await this.mailer.sendTestMail(config.mail_from);
|
|
||||||
return new ResponseEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user