Commit 08fc56a2 authored by Karen Konou's avatar Karen Konou

[WIP] forgot password route

parent af97f328
Pipeline #2934 failed with stage
in 0 seconds
......@@ -5,7 +5,8 @@ import Gargantext.Prelude
import Data.Array (filter, length)
import Data.Array as A
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Map as M
import Data.Maybe (Maybe(..), fromMaybe)
import Data.UUID (UUID)
import Data.UUID as UUID
import Effect (Effect)
......@@ -316,6 +317,7 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where
GR.Team s n -> team (sessionNodeProps s n) []
GR.NodeTexts s n -> texts (sessionNodeProps s n) []
GR.UserPage s n -> user (sessionNodeProps s n) []
GR.ForgotPassword p -> forgotPassword {boxes, params: p} []
]
--------------------------------------------------------------
......@@ -690,3 +692,19 @@ contactCpt = here.component "contact" cpt where
} `Record.merge` sessionProps
pure $ authed authedProps []
--------------------------------------------------------------
type ForgotPasswordProps = ( params :: (M.Map String String) | Props)
forgotPassword :: R2.Component ForgotPasswordProps
forgotPassword = R.createElement forgotPasswordCpt
forgotPasswordCpt :: R.Component ForgotPasswordProps
forgotPasswordCpt = here.component "forgotPassword" cpt where
cpt { params } _ = do
pure $
H.div {} [
H.p {} [ H.text ("server: " <> fromMaybe "" (M.lookup "server" params))]
, H.p {} [ H.text ("uuid: " <> fromMaybe "" (M.lookup "uuid" params))]
]
\ No newline at end of file
......@@ -6,11 +6,12 @@ import Data.Foldable (oneOf)
import Data.Int (floor)
import Gargantext.Routes (AppRoute(..))
import Gargantext.Types (SessionId(..))
import Routing.Match (Match, lit, num, str)
import Routing.Match (Match, lit, num, params, str)
router :: Match AppRoute
router = oneOf
[ Login <$ route "login"
, ForgotPassword <$> (route "forgotPassword" *> params)
, Folder <$> (route "folder" *> sid) <*> int
, FolderPrivate <$> (route "folderPrivate" *> sid) <*> int
, FolderPublic <$> (route "folderPublic" *> sid) <*> int
......
......@@ -4,6 +4,7 @@ import Prelude
import Data.Maybe (Maybe(..))
import Data.UUID (UUID)
import Data.Map as M
import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, DocId, NgramsGetOpts, NgramsGetTableAllOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList)
import Gargantext.Types as GT
......@@ -32,6 +33,7 @@ data AppRoute
| Team SessionId Int
| NodeTexts SessionId Int
| UserPage SessionId Int
| ForgotPassword (M.Map String String)
derive instance Eq AppRoute
......@@ -63,6 +65,7 @@ data SessionRoute
instance Show AppRoute where
show Home = "Home"
show Login = "Login"
show (ForgotPassword u) = "ForgotPassword" <> show u
show (Folder s i) = "Folder" <> show i <> " (" <> show s <> ")"
show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")"
show (FolderPublic s i) = "FolderPublic" <> show i <> " (" <> show s <> ")"
......@@ -90,11 +93,12 @@ instance Show AppRoute where
appPath :: AppRoute -> String
appPath Home = ""
appPath Login = "login"
appPath (Folder s i) = "folder/" <> show s <> "/" <> show i
appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i
appPath (FolderPublic s i) = "folderPublic/" <> show s <> "/" <> show i
appPath (FolderShared s i) = "folderShared/" <> show s <> "/" <> show i
appPath (Team s i) = "team/" <> show s <> "/" <> show i
appPath (ForgotPassword u) = "forgotPassword/" <> show u
appPath (Folder s i) = "folder/" <> show s <> "/" <> show i
appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i
appPath (FolderPublic s i) = "folderPublic/" <> show s <> "/" <> show i
appPath (FolderShared s i) = "folderShared/" <> show s <> "/" <> show i
appPath (Team s i) = "team/" <> show s <> "/" <> show i
appPath (CorpusDocument s c l i) = "corpus/" <> show s <> "/" <> show c <> "/list/" <> show l <> "/document/" <> show i
appPath (Corpus s i) = "corpus/" <> show s <> "/" <> show i
appPath (CorpusCode s i) = "corpusCode/" <> show s <> "/" <> show i
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment