-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import type { IEmailDescriptor } from '../email'; | ||
|
||
export interface IEmailCreator { | ||
/** | ||
* Sends an OTP through the configured SMTP server within Rocket.Chat | ||
* Sends an email through Rocket.Chat | ||
* | ||
* @param email the email that will recieve the TOTP | ||
* @param code is the code that is going to be sent via email | ||
* @param language is the language that is going to be used within Rocket.Chat | ||
* @param email the email data | ||
*/ | ||
sendOTPThroughSMTP(email: string, code: string, language: string): Promise<any>; | ||
send(email: IEmailDescriptor): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import type { AppBridges } from '../bridges'; | ||
import type { IEmailCreator } from '../../definition/accessors/IEmailCreator'; | ||
import type { IEmailDescriptor } from '../../definition/email'; | ||
|
||
export class EmailCreator implements IEmailCreator { | ||
constructor(private readonly bridges: AppBridges, private readonly appId: string) {} | ||
|
||
public async sendOTPThroughSMTP(email: string, code: string, language: string): Promise<void> { | ||
return this.bridges.getEmailBridge().doSendOtpCodeThroughSMTP(email, code, language, this.appId); | ||
public async send(email: IEmailDescriptor): Promise<void> { | ||
return this.bridges.getEmailBridge().doSendEmail(email, this.appId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import type { IEmailDescriptor } from '../../../src/definition/email'; | ||
import { EmailBridge } from '../../../src/server/bridges/EmailBridge'; | ||
|
||
export class TestsEmailBridge extends EmailBridge { | ||
protected sendOtpCodeThroughSMTP(email: string, code: string, language: string): Promise<void> { | ||
protected sendEmail(email: IEmailDescriptor, appId: string): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |