Fix missing fields when creating a new MagicLink

This commit is contained in:
Alice Gaudon 2020-05-09 23:37:12 +02:00
parent e574b6e778
commit 309344d1c0
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "wms-core", "name": "wms-core",
"version": "0.4.28", "version": "0.4.30",
"description": "Node web framework", "description": "Node web framework",
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git", "repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
"author": "Alice Gaudon <alice@gaudon.pro>", "author": "Alice Gaudon <alice@gaudon.pro>",

View File

@ -9,7 +9,7 @@ import MagicLink from "../models/MagicLink";
import config from "config"; import config from "config";
export default abstract class MagicLinkController extends Controller { export default abstract class MagicLinkController extends Controller {
public static async sendMagicLink(sessionID: string, actionType: string, email: string, mailTemplate: MailTemplate, data: object, req: Request, res: Response): Promise<void> { public static async sendMagicLink(sessionID: string, actionType: string, original_url: string, email: string, mailTemplate: MailTemplate, data: object, req: Request, res: Response): Promise<void> {
Throttler.throttle('magic_link', 2, MagicLink.validityPeriod(), sessionID, 0, 0); Throttler.throttle('magic_link', 2, MagicLink.validityPeriod(), sessionID, 0, 0);
Throttler.throttle('magic_link', 1, MagicLink.validityPeriod(), email, 0, 0); Throttler.throttle('magic_link', 1, MagicLink.validityPeriod(), email, 0, 0);
@ -17,6 +17,8 @@ export default abstract class MagicLinkController extends Controller {
if (!link) { if (!link) {
link = new MagicLink({ link = new MagicLink({
session_id: sessionID, session_id: sessionID,
action_type: actionType,
original_url: original_url,
}); });
} }