-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
broken by #1786
- Loading branch information
Showing
5 changed files
with
36 additions
and
52 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 |
---|---|---|
|
@@ -114,18 +114,18 @@ export default class CreateAuthCodeAction extends CreateAuthCodeActionBase { | |
FakeComms.send({ | ||
to: input.emailAddress, | ||
mode: Mode.EMAIL, | ||
from: "[email protected]", | ||
subject: "auth code", | ||
body: `your auth code is ${input.code}`, | ||
from: input.from ?? "[email protected]", | ||
subject: input.subject ?? "auth code", | ||
body: input.body ?? `your auth code is ${input.code}`, | ||
}); | ||
} | ||
if (input.phoneNumber) { | ||
// send sms | ||
FakeComms.send({ | ||
to: input.phoneNumber, | ||
mode: Mode.SMS, | ||
from: "42423", | ||
body: `your auth code is ${input.code}`, | ||
from: input.from ?? "42423", | ||
body: input.body ?? `your auth code is ${input.code}`, | ||
}); | ||
} | ||
}, | ||
|
3 changes: 3 additions & 0 deletions
3
examples/simple/src/ent/generated/auth_code/actions/create_auth_code_action_base.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,13 +4,12 @@ import { | |
} from "../../generated/user/actions/edit_email_address_action_base"; | ||
import { UserBuilder } from "../../generated/user/actions/user_builder"; | ||
import CreateAuthCodeAction from "../../auth_code/actions/create_auth_code_action"; | ||
import { FakeComms, Mode } from "@snowtop/ent/testutils/fake_comms"; | ||
import { User } from "../.."; | ||
import { EditUserPrivacy } from "./edit_user_privacy"; | ||
|
||
export { EditEmailAddressInput }; | ||
import { ExampleViewer } from "../../../viewer/viewer"; | ||
import { Validator, Trigger, Observer } from "@snowtop/ent/action"; | ||
import { Validator, Trigger } from "@snowtop/ent/action"; | ||
|
||
class NewAuthCode { | ||
private code: string = ""; | ||
|
@@ -27,25 +26,18 @@ class NewAuthCode { | |
} | ||
|
||
changeset(builder: UserBuilder, input: EditEmailAddressInput) { | ||
const link = `https://website/confirm?email=${ | ||
input.newEmail | ||
}&code=${this.getCode()}`; | ||
|
||
return CreateAuthCodeAction.create(builder.viewer, { | ||
emailAddress: input.newEmail, | ||
userId: builder.viewer.viewerID!, | ||
code: this.getCode(), | ||
}).changeset(); | ||
} | ||
|
||
observe(_builder: UserBuilder, input: EditEmailAddressInput) { | ||
let link = `https://website/confirm?email=${ | ||
input.newEmail | ||
}&code=${this.getCode()}`; | ||
|
||
FakeComms.send({ | ||
to: input.newEmail, | ||
mode: Mode.EMAIL, | ||
subject: "confirm email", | ||
from: "[email protected]", | ||
body: link, | ||
}); | ||
}).changeset(); | ||
} | ||
} | ||
|
||
|
@@ -82,16 +74,6 @@ export default class EditEmailAddressAction extends EditEmailAddressActionBase { | |
return [this.generateNewCode]; | ||
} | ||
|
||
getObservers(): Observer< | ||
User, | ||
UserBuilder<EditEmailAddressInput, User>, | ||
ExampleViewer, | ||
EditEmailAddressInput, | ||
User | ||
>[] { | ||
return [this.generateNewCode]; | ||
} | ||
|
||
getPrivacyPolicy() { | ||
return EditUserPrivacy; | ||
} | ||
|
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