Skip to content

Commit

Permalink
Update installer for magic link auth
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxcarlson committed Jul 16, 2024
1 parent eb6fe31 commit 5b92b94
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ install:
cp vendor-secret/Env.elm counter/src
npx elm-review --config preview counter/src --debug --fix-all

elm-json:
elm-json install MartinSStewart/elm-nonempty-string

uninstall:
cp vendor-open/Env.elm src/
cp -r counter-original/src/. counter/src/

1 change: 1 addition & 0 deletions elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {
"MartinSStewart/elm-nonempty-string": "2.0.0 <= v < 3.0.0",
"elm/core": "1.0.5 <= v < 2.0.0",
"elmcraft/core-extra": "2.0.0 <= v < 3.0.0",
"jfmengels/elm-review": "2.13.0 <= v < 3.0.0",
Expand Down
39 changes: 18 additions & 21 deletions preview/src/ReviewConfig.elm
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ configUsers =
configMagicLinkMinimal : List Rule
configMagicLinkMinimal =
[ Import.qualified "Types" [ "Dict", "AssocList", "EmailAddress", "LocalUUID", "Auth.Common", "MagicLink.Types", "Session", "User" ] |> Import.makeRule
, Import.qualified "Frontend" [ "Dict", "MagicLink.Types", "Auth.Common", "MagicLink.Frontend", "MagicLink.Auth" , "Pages.SignIn"] |> Import.makeRule
, Import.qualified "Frontend" [ "Dict", "MagicLink.Types", "Auth.Common", "MagicLink.Frontend", "MagicLink.Auth", "Pages.SignIn" ] |> Import.makeRule
, Import.qualified "Backend" [ "Dict", "AssocList", "Time", "Auth.Flow", "MagicLink.Auth", "User", "LocalUUID" ] |> Import.makeRule

, TypeVariant.makeRule "Types" "FrontendMsg" [ "AuthFrontendMsg MagicLink.Types.Msg" ]
, TypeVariant.makeRule "Types" "BackendMsg" [ "AuthBackendMsg Auth.Common.BackendMsg" ]
, TypeVariant.makeRule "Types" "ToBackend" [ "AuthToBackend Auth.Common.ToBackend" ]
Expand All @@ -137,9 +136,9 @@ configMagicLinkMinimal =
, "RegistrationError String"
, "UserRegistered User.User"
, "SignInError String"

--, "CheckSignInResponse (Result BackendDataStatus User.SignInData)"
]

, FieldInTypeAlias.makeRule "Types"
"BackendModel"
[ "localUuidData : Maybe LocalUUID.Data"
Expand All @@ -155,31 +154,29 @@ configMagicLinkMinimal =
, "userNameToEmailString : Dict.Dict User.Username User.EmailString"
, "time: Time.Posix"
, "randomAtmosphericNumbers: Maybe (List Int)"


]
, Initializer.makeRule "Frontend" "initLoaded" [ { field = "magicLinkModel", value = "Pages.SignIn.init loadingModel.initUrl" } ]
, Initializer.makeRule "Backend"
"init"
[ { field = "randomAtmosphericNumbers", value = "Just [ 235880, 700828, 253400, 602641 ]" }
, { field = "time", value = "Time.millisToPosix 0" }
, { field = "sessions", value = "Dict.empty" }
, { field = "userNameToEmailString", value = "Dict.empty" }
, { field = "users", value = "Dict.empty" }
, { field = "sessionInfo", value = "Dict.empty" }
, { field = "pendingAuths", value = "Dict.empty" }
, { field = "localUuidData", value = "LocalUUID.initFrom4List [ 235880, 700828, 253400, 602641 ]" }
, { field = "pendingEmailAuths", value = "Dict.empty" }
, { field = "secretCounter", value = "0" }
, { field = "sessionDict", value = "AssocList.empty" }
, { field = "pendingLogins", value = "AssocList.empty" }
, { field = "log", value = "[]" }
]
"init"
[ { field = "randomAtmosphericNumbers", value = "Just [ 235880, 700828, 253400, 602641 ]" }
, { field = "time", value = "Time.millisToPosix 0" }
, { field = "sessions", value = "Dict.empty" }
, { field = "userNameToEmailString", value = "Dict.empty" }
, { field = "users", value = "Dict.empty" }
, { field = "sessionInfo", value = "Dict.empty" }
, { field = "pendingAuths", value = "Dict.empty" }
, { field = "localUuidData", value = "LocalUUID.initFrom4List [ 235880, 700828, 253400, 602641 ]" }
, { field = "pendingEmailAuths", value = "Dict.empty" }
, { field = "secretCounter", value = "0" }
, { field = "sessionDict", value = "AssocList.empty" }
, { field = "pendingLogins", value = "AssocList.empty" }
, { field = "log", value = "[]" }
]
, ClauseInCase.init "Frontend" "updateLoaded" "AuthFrontendMsg authToFrontendMsg" "MagicLink.Auth.update authToFrontendMsg model.magicLinkModel |> Tuple.mapFirst (\\magicLinkModel -> { model | magicLinkModel = magicLinkModel })" |> ClauseInCase.makeRule
, ClauseInCase.init "Backend" "updateFromFrontend" "AuthToBackend authMsg" "Auth.Flow.updateFromFrontend (MagicLink.Auth.backendConfig model) clientId sessionId authMsg model" |> ClauseInCase.makeRule
, ClauseInCase.init "Backend" "update" "AuthBackendMsg _" "(model, Cmd.none)" |> ClauseInCase.makeRule
, ReplaceFunction.init "Frontend" "tryLoading" tryLoading2
|> ReplaceFunction.makeRule
|> ReplaceFunction.makeRule
]


Expand Down

0 comments on commit 5b92b94

Please sign in to comment.