Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
c99eb587
Commit
c99eb587
authored
May 20, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN/ERGO] Login form
parent
8d391cd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
29 deletions
+45
-29
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+16
-18
Login.purs
src/Gargantext/Components/Login.purs
+29
-11
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
c99eb587
...
@@ -24,8 +24,7 @@ import Gargantext.Sessions (OpenNodes, Session, mkNodeId)
...
@@ -24,8 +24,7 @@ import Gargantext.Sessions (OpenNodes, Session, mkNodeId)
import Gargantext.Types as GT
import Gargantext.Types as GT
type CommonProps =
type CommonProps =
(
( frontends :: Frontends
frontends :: Frontends
, mCurrentRoute :: Maybe AppRoute
, mCurrentRoute :: Maybe AppRoute
, openNodes :: R.State OpenNodes
, openNodes :: R.State OpenNodes
, reload :: R.State Reload
, reload :: R.State Reload
...
@@ -154,8 +153,7 @@ childNodes props@{ children } =
...
@@ -154,8 +153,7 @@ childNodes props@{ children } =
el = R.hooksComponent "ChildNodeView" cpt
el = R.hooksComponent "ChildNodeView" cpt
cpt {tree, asyncTasks} _ = do
cpt {tree, asyncTasks} _ = do
tasks <- R.useState' asyncTasks
tasks <- R.useState' asyncTasks
pure $ toHtml (Record.merge commonProps
pure $ toHtml (Record.merge commonProps { tasks, tree })
{ tasks, tree })
type PerformActionProps =
type PerformActionProps =
( openNodes :: R.State OpenNodes
( openNodes :: R.State OpenNodes
...
...
src/Gargantext/Components/Login.purs
View file @
c99eb587
...
@@ -3,11 +3,12 @@
...
@@ -3,11 +3,12 @@
-- Select a backend and log into it
-- Select a backend and log into it
module Gargantext.Components.Login where
module Gargantext.Components.Login where
import Prelude (Unit, bind, const, discard, pure, show, ($), (<>), (*>), (<$>), (>), map)
import Prelude (Unit, bind, const, discard, pure, show, ($), (<>), (*>), (<$>), (>), map
, (==), (/=), not, (&&)
)
import Data.Array (head)
import Data.Array (head)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.String as DST
import Data.String as DST
import DOM.Simple.Console (log)
import DOM.Simple.Console (log)
import Data.Sequence as DS
import Data.Sequence as DS
...
@@ -32,7 +33,8 @@ import Gargantext.Utils.Reactix as R2
...
@@ -32,7 +33,8 @@ import Gargantext.Utils.Reactix as R2
type Props =
type Props =
( backends :: Array Backend
( backends :: Array Backend
, sessions :: R2.Reductor Sessions Sessions.Action
, sessions :: R2.Reductor Sessions Sessions.Action
, visible :: R.State Boolean )
, visible :: R.State Boolean
)
type ModalProps = ( visible :: R.State Boolean )
type ModalProps = ( visible :: R.State Boolean )
...
@@ -147,7 +149,8 @@ renderBackend state backend@(Backend {name}) =
...
@@ -147,7 +149,8 @@ renderBackend state backend@(Backend {name}) =
type FormProps =
type FormProps =
( backend :: Backend
( backend :: Backend
, sessions :: R2.Reductor Sessions Sessions.Action
, sessions :: R2.Reductor Sessions Sessions.Action
, visible :: R.State Boolean )
, visible :: R.State Boolean
)
form :: Record FormProps -> R.Element
form :: Record FormProps -> R.Element
form props = R.createElement formCpt props []
form props = R.createElement formCpt props []
...
@@ -159,6 +162,7 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
...
@@ -159,6 +162,7 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
error <- R.useState' ""
error <- R.useState' ""
username <- R.useState' ""
username <- R.useState' ""
password <- R.useState' ""
password <- R.useState' ""
setBox@(checkBox /\ setCheckBox) <- R.useState' false
pure $ R2.row
pure $ R2.row
[ cardGroup
[ cardGroup
[ card
[ card
...
@@ -175,9 +179,18 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
...
@@ -175,9 +179,18 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
, center
, center
[ H.label {}
[ H.label {}
[ H.div {className: "checkbox"}
[ H.div {className: "checkbox"}
[ termsCheckbox {}, H.text "I accept the terms of use ", termsLink {} ] ]
[ termsCheckbox setBox , H.text "I accept the terms of use ", termsLink {} ] ]
, loginSubmit $
]
onClick props error username password ] ] ] ] ] ]
]
, if checkBox == true
&& fst username /= ""
&& fst password /= ""
then H.div {} [center [loginSubmit $ onClick props error username password]]
else H.div {} []
]
]
]
]
onClick {backend, sessions, visible} error username password e =
onClick {backend, sessions, visible} error username password e =
launchAff_ $ do
launchAff_ $ do
let req = AuthRequest {username: fst username, password: fst password}
let req = AuthRequest {username: fst username, password: fst password}
...
@@ -194,13 +207,18 @@ csrfTokenInput _ =
...
@@ -194,13 +207,18 @@ csrfTokenInput _ =
H.input { type: "hidden", name: "csrfmiddlewaretoken"
H.input { type: "hidden", name: "csrfmiddlewaretoken"
, value: csrfMiddlewareToken }-- TODO hard-coded CSRF token
, value: csrfMiddlewareToken }-- TODO hard-coded CSRF token
termsCheckbox :: {} -> R.Element
termsCheckbox :: R.State Boolean -> R.Element
termsCheckbox _ =
termsCheckbox setCheckBox =
H.input { id: "terms-accept", type: "checkbox", value: "", className: "checkbox" }
H.input { id: "terms-accept"
, type: "checkbox"
, value: fst setCheckBox
, className: "checkbox"
, on: { click: \_ -> (snd setCheckBox) $ const $ not (fst setCheckBox)}
}
termsLink :: {} -> R.Element
termsLink :: {} -> R.Element
termsLink _ =
termsLink _ =
H.a { target: "_blank", href: termsUrl } [ H.text " [
Read the terms of use ]
" ]
H.a { target: "_blank", href: termsUrl } [ H.text " [
Read the terms of use]
" ]
where termsUrl = "http://gitlab.iscpif.fr/humanities/tofu/tree/master"
where termsUrl = "http://gitlab.iscpif.fr/humanities/tofu/tree/master"
requestAccessLink :: {} -> R.Element
requestAccessLink :: {} -> R.Element
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment