mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Send emails when 2FA settings are updated
Summary: When user 2FA status is changed, we now send out emails via SendGrid. Test Plan: Server tests. Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3280
This commit is contained in:
@@ -35,6 +35,7 @@ import {makeId} from 'app/server/lib/idUtils';
|
||||
import * as log from 'app/server/lib/log';
|
||||
import {Permit} from 'app/server/lib/Permit';
|
||||
import {WebHookSecret} from "app/server/lib/Triggers";
|
||||
import {StringUnion} from 'app/common/StringUnion';
|
||||
import {EventEmitter} from 'events';
|
||||
import flatten = require('lodash/flatten');
|
||||
import pick = require('lodash/pick');
|
||||
@@ -48,6 +49,17 @@ import * as uuidv4 from "uuid/v4";
|
||||
// fixed. See https://github.com/typeorm/typeorm/issues/1884#issuecomment-380767213
|
||||
applyPatch();
|
||||
|
||||
export const NotifierEvents = StringUnion(
|
||||
'addUser',
|
||||
'userChange',
|
||||
'firstLogin',
|
||||
'addBillingManager',
|
||||
'teamCreator',
|
||||
'trialPeriodEndingSoon',
|
||||
);
|
||||
|
||||
export type NotifierEvent = typeof NotifierEvents.type;
|
||||
|
||||
// Nominal email address of a user who can view anything (for thumbnails).
|
||||
export const PREVIEWER_EMAIL = 'thumbnail@getgrist.com';
|
||||
|
||||
@@ -190,6 +202,10 @@ export class HomeDBManager extends EventEmitter {
|
||||
|
||||
private _docAuthCache = new MapWithTTL<string, Promise<DocAuthResult>>(DOC_AUTH_CACHE_TTL);
|
||||
|
||||
public emit(event: NotifierEvent, ...args: any[]): boolean {
|
||||
return super.emit(event, ...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Five aclRules, each with one group (with the names 'owners', 'editors', 'viewers',
|
||||
* 'guests', and 'members') are created by default on every new entity (Organization,
|
||||
|
||||
Reference in New Issue
Block a user