-
Notifications
You must be signed in to change notification settings - Fork 3
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
James Carlson
authored and
James Carlson
committed
Jul 11, 2024
1 parent
1a18acc
commit f97c125
Showing
2 changed files
with
105 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ ElmjutsuDumMyM0DuL3.elm | |
|
||
### | ||
vendor-secret/ | ||
counter/ | ||
counter/src | ||
counter/elm-stuff |
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
``` | ||
``` | ||
|
||
# Summary of Auth Messages | ||
|
||
## Phase I | ||
|
||
1. `AuthFrontendMsg SubmitEmailForSignIn` | ||
2. `AuthFrontendMsg (AuthSigninRequested { email = Just "[email protected]", methodId = "EmailMagicLink" })` | ||
|
||
3. `AuthToBackend (AuthSigninInitiated { baseUrl = { fragment = Nothing, host = "localhost", path = "/admin", port_ = Just 8000, protocol = Http, query = Nothing }, methodId = "EmailMagicLink", username = Just "[email protected]" })` | ||
4. `AuthToFrontend (ReceivedMessage (Ok "We have sent you a login email at [email protected]"))` | ||
|
||
## Phase II | ||
|
||
1. `AuthFrontendMsg (ReceivedSigninCode "14477875")` | ||
2. `AuthToBackend (AuthSigInWithToken 14477875)` | ||
3. `AuthToFrontend (AuthSignInWithTokenResponse (Ok { email = "[email protected]", name = "Jim Carlson", roles = [AdminRole,UserRole], username = "jxxcarlson" }))` | ||
4. `SignInUser { email = "[email protected]", name = "Jim Carlson", roles = [AdminRole,UserRole], username = "jxxcarlson" }` | ||
|
||
|
||
## Types | ||
|
||
``` | ||
type FrontendMsg | ||
= ... | ||
| AuthFrontendMsg MagicLink.Types.Msg | ||
type BackendMsg | ||
= ... | ||
| AuthBackendMsg Auth.Common.BackendMsg | ||
type ToFrontend | ||
= ... | ||
| AuthToFrontend Auth.Common.ToFrontend | ||
type ToBackend | ||
= ... | ||
| AuthToBackend Auth.Common.ToBackend | ||
``` | ||
|
||
## Messages | ||
|
||
``` | ||
-- FRONTEND | ||
updateLoaded : FrontendMsg -> LoadedModel -> ( LoadedModel, Cmd FrontendMsg ) | ||
... | ||
AuthFrontendMsg authToFrontendMsg -> | ||
MagicLink.Auth.update authToFrontendMsg model.magicLinkModel | ||
|> Tuple.mapFirst (\magicLinkModel -> { model | magicLinkModel = magicLinkModel }) | ||
updateFromBackendLoaded : ToFrontend -> LoadedModel -> ( LoadedModel, Cmd FrontendMsg ) | ||
... | ||
AuthToFrontend authToFrontendMsg -> | ||
MagicLink.Auth.updateFromBackend authToFrontendMsg model.magicLinkModel | ||
|> Tuple.mapFirst | ||
(\magicLinkModel -> { model | magicLinkModel = magicLinkModel }) | ||
-- BACKEND | ||
update : BackendMsg -> BackendModel -> ( BackendModel, Cmd BackendMsg ) | ||
AuthBackendMsg authMsg -> | ||
Auth.Flow.backendUpdate (MagicLink.Auth.backendConfig model) | ||
updateFromBackendLoaded : ToFrontend -> LoadedModel -> ( LoadedModel, Cmd FrontendMsg ) | ||
AutoLogin sessionId loginData -> | ||
( model, Lamdera.sendToFrontend sessionId (AuthToFrontend <| Auth.Common.AuthSignInWithTokenResponse <| Ok <| loginData) ) | ||
``` | ||
|
||
# Log | ||
|
||
|
||
1. `F : AuthFrontendMsg SubmitEmailForSignIn` | ||
|
||
2. `F : AuthFrontendMsg (AuthSigninRequested { email = Just "[email protected]", methodId = "EmailMagicLink" })` | ||
|
||
3. `F▶️ : AuthToBackend (AuthSigninInitiated { baseUrl = { fragment = Nothing, host = "localhost", path = "/admin", port_ = Just 8000, protocol = Http, query = Nothing }, methodId = "EmailMagicLink", username = Just "[email protected]" })` | ||
|
||
4. `▶️B: AuthToBackend (AuthSigninInitiated { baseUrl = { fragment = Nothing, host = "localhost", path = "/admin", port_ = Just 8000, protocol = Http, query = Nothing }, methodId = "EmailMagicLink", username = Just "[email protected]" })` | ||
|
||
5. `◀️B: AuthToFrontend (ReceivedMessage (Ok "We have sent you a login email at [email protected]"))` | ||
|
||
6. `F◀️: AuthToFrontend (ReceivedMessage (Ok "We have sent you a login email at [email protected]"))` | ||
|
||
7. `F: AuthFrontendMsg (ReceivedSigninCode "14477875")` | ||
|
||
|
||
8. `F▶️: AuthToBackend (AuthSigInWithToken 14477875)` | ||
|
||
|
||
9. `▶️B: AuthToBackend (AuthSigInWithToken 14477875)` | ||
|
||
|
||
10. `◀️B : AuthToFrontend (AuthSignInWithTokenResponse (Ok { email = "[email protected]", name = "Jim Carlson", roles = [AdminRole,UserRole], username = "jxxcarlson" }))` | ||
|
||
|
||
11. `F◀️ : AuthToFrontend (AuthSignInWithTokenResponse (Ok { email = "[email protected]", name = "Jim Carlson", roles = [AdminRole,UserRole], username = "jxxcarlson" }))` | ||
|
||
12. `F: SignInUser { email = "[email protected]", name = "Jim Carlson", roles = [AdminRole,UserRole], username = "jxxcarlson" }` |