(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:
George Gevoian
2022-02-23 16:27:16 -08:00
parent 8f1889d2d7
commit ff4e5d2769
3 changed files with 25 additions and 2 deletions

View File

@@ -99,7 +99,6 @@ export class FlexServer implements GristServer {
public host: string;
public tag: string;
public info = new Array<[string, any]>();
public notifier: INotifier;
public usage: Usage;
public housekeeper: Housekeeper;
public server: http.Server;
@@ -123,6 +122,7 @@ export class FlexServer implements GristServer {
private _storageManager: IDocStorageManager;
private _docWorkerMap: IDocWorkerMap;
private _widgetRepository: IWidgetRepository;
private _notifier: INotifier;
private _internalPermitStore: IPermitStore; // store for permits that stay within our servers
private _externalPermitStore: IPermitStore; // store for permits that pass through outside servers
private _disabled: boolean = false;
@@ -286,6 +286,11 @@ export class FlexServer implements GristServer {
return this._widgetRepository;
}
public getNotifier(): INotifier {
if (!this._notifier) { throw new Error('no notifier available'); }
return this._notifier;
}
public addLogging() {
if (this._check('logging')) { return; }
if (process.env.GRIST_LOG_SKIP_HTTP) { return; }
@@ -1254,7 +1259,7 @@ export class FlexServer implements GristServer {
// and all that is needed is a refactor to pass that info along. But there is also the
// case of notification(s) from stripe. May need to associate a preferred base domain
// with org/user and persist that?
this.notifier = this.create.Notifier(this._dbManager, this);
this._notifier = this.create.Notifier(this._dbManager, this);
}
public getGristConfig(): GristLoadConfig {

View File

@@ -9,6 +9,7 @@ import * as Comm from 'app/server/lib/Comm';
import { Hosts } from 'app/server/lib/extractOrg';
import { ICreate } from 'app/server/lib/ICreate';
import { IDocStorageManager } from 'app/server/lib/IDocStorageManager';
import { INotifier } from 'app/server/lib/INotifier';
import { IPermitStore } from 'app/server/lib/Permit';
import { Sessions } from 'app/server/lib/Sessions';
import * as express from 'express';
@@ -34,6 +35,7 @@ export interface GristServer {
getHosts(): Hosts;
getHomeDBManager(): HomeDBManager;
getStorageManager(): IDocStorageManager;
getNotifier(): INotifier;
}
export interface GristLoginSystem {