[CORL-380] Duplicate Email Error (#2320)

* fix: throw duplicate email error during signup

* fix: Coral.Coral.* -> Coral.*

* fix: tests
This commit is contained in:
Kiwi
2019-05-22 22:07:07 +02:00
committed by GitHub
parent 6da97c57d7
commit 8618ef0b96
6 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
<h1 style="text-align: center">Coral 5.0 Embed Stream</h1>
<div id="coralStreamEmbed" style="max-width: 640px; margin: 0 auto"></div>
<script>
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
const CoralStreamEmbed = Coral.createStreamEmbed({
id: "coralStreamEmbed",
});
window.CoralStreamEmbed = CoralStreamEmbed;
+3 -3
View File
@@ -14,7 +14,7 @@ describe("Basic integration test", () => {
});
it("should render iframe", () => {
mockConsole();
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
const CoralEmbedStream = Coral.createStreamEmbed({
id: "basic-integration-test-id",
});
CoralEmbedStream.render();
@@ -28,7 +28,7 @@ describe("Basic integration test", () => {
link.rel = "canonical";
link.href = "http://localhost/canonical";
document.head!.appendChild(link);
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
const CoralEmbedStream = Coral.createStreamEmbed({
id: "basic-integration-test-id",
});
CoralEmbedStream.render();
@@ -39,7 +39,7 @@ describe("Basic integration test", () => {
});
it("should remove iframe", () => {
mockConsole();
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
const CoralEmbedStream = Coral.createStreamEmbed({
id: "basic-integration-test-id",
});
CoralEmbedStream.render();
+1 -2
View File
@@ -1,2 +1 @@
import * as CoralImport from "./Coral";
export const Coral = CoralImport;
export * from "./Coral";
+1 -1
View File
@@ -118,7 +118,7 @@
</p>
<div id="coralStreamEmbed" style="max-width: 640px; margin: 0 auto"></div>
<script>
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
const CoralStreamEmbed = Coral.createStreamEmbed({
id: "coralStreamEmbed",
autoRender: true,
});
+1 -1
View File
@@ -121,7 +121,7 @@
<button id="showComments">Show Comments</button>
</div>
<script>
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
const CoralStreamEmbed = Coral.createStreamEmbed({
id: "coralStreamEmbed",
});
window.CoralStreamEmbed = CoralStreamEmbed;
+4
View File
@@ -403,6 +403,10 @@ export async function insertUser(
// Evaluate the error, if it is in regards to violating the unique index,
// then return a duplicate Story error.
if (err instanceof MongoError && err.code === 11000) {
// Check if duplicate index was about the email.
if (err.errmsg && err.errmsg.includes("tenantID_1_email_1")) {
throw new DuplicateEmailError(input.email!);
}
throw new DuplicateUserError();
}