Fix rememberme for missing local storage

This commit is contained in:
Eike Kettner 2020-12-04 22:57:21 +01:00
parent 5eaa8e9ac6
commit 0b6f965fcb
3 changed files with 16 additions and 14 deletions

View File

@ -124,11 +124,13 @@ object Login {
minTime = now - config.rememberMe.valid
data <- OptionT(store.transact(QLogin.findByRememberMe(rid, minTime).value))
_ <- OptionT.liftF(
logF.warn(s"Account lookup via remember me: $data")
logF.info(s"Account lookup via remember me: $data")
)
res <- OptionT.liftF(
if (checkNoPassword(data)) okResult(data.account)
else Result.invalidAuth.pure[F]
if (checkNoPassword(data))
logF.info("RememberMe auth successful") *> okResult(data.account)
else
logF.warn("RememberMe auth not successfull") *> Result.invalidAuth.pure[F]
)
} yield res).getOrElseF(
logF.info("RememberMe not found in database.") *> Result.invalidAuth.pure[F]

View File

@ -7,7 +7,6 @@ import Api
import App.Data exposing (..)
import Browser exposing (UrlRequest(..))
import Browser.Navigation as Nav
import Comp.LinkTarget
import Data.Flags
import Page exposing (Page(..))
import Page.CollectiveSettings.Data
@ -112,7 +111,16 @@ updateWithSub msg model =
command =
if lr.success then
Api.refreshSession newFlags SessionCheckResp
Cmd.batch
[ Api.refreshSession newFlags SessionCheckResp
, Ports.setAccount lr
, case model.flags.account of
Just _ ->
Cmd.none
Nothing ->
Page.goto model.page
]
else
Cmd.batch

View File

@ -51,21 +51,13 @@ init flags url key =
else
( im, Page.goto page, Sub.none )
sessionCheck =
case m.flags.account of
Just _ ->
Api.loginSession flags SessionCheckResp
Nothing ->
Cmd.none
in
( { m | subs = s }
, Cmd.batch
[ cmd
, ic
, Api.versionInfo flags VersionResp
, sessionCheck
, Api.loginSession flags SessionCheckResp
, Ports.getUiSettings flags
]
)