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
12b16a59
Commit
12b16a59
authored
Nov 27, 2017
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JWT done
parent
d06e5b8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
Landing.purs
src/Landing.purs
+1
-1
Login.purs
src/Login.purs
+21
-5
No files found.
src/Landing.purs
View file @
12b16a59
...
...
@@ -143,7 +143,7 @@ loginSpec = simpleSpec performAction render
[ a [ className "btn btn-primary btn-lg",onClick \_ -> dispatch $ Submit , title "Click and test by yourself" ]
[ span [ className "glyphicon glyphicon-hand-right" ]
[]
, text " Login
$$$
"
, text " Login"
]
, a [ className "btn btn-warning btn-lg", href "https://iscpif.fr/services/applyforourservices/", target "blank", title "Fill the form to sign up" ]
[ span [ aria {hidden : true}, className "glyphicon glyphicon-hand-right" ]
...
...
src/Login.purs
View file @
12b16a59
...
...
@@ -20,9 +20,10 @@ import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div)
import React.DOM (a, button, div, form, h2, h4, i, input, label, p, span, text)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, placeholder, target, value)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick,
onInput,
placeholder, target, value)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
newtype State = State
...
...
@@ -44,12 +45,23 @@ initialState = State
data Action
= NoOp
| Login
| SetUserName String
| SetPassword String
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
performAction NoOp _ _ = void do
modifyState id
performAction (SetUserName usr) _ _ = void do
modifyState \(State state) -> State $ state { username = usr }
performAction (SetPassword pwd) _ _ = void do
modifyState \(State state) -> State $ state { password = pwd }
performAction Login _ (State state) = void do
res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password }
case res of
...
...
@@ -98,10 +110,10 @@ renderSpec = simpleSpec performAction render
[]
, div [className "form-group"]
[ p [] [text state.errorMessage]
, input [className "form-control", _id "id_username",maxLength "254", name "username", placeholder "username", _type "text",value state.username] []
, input [className "form-control", _id "id_username",maxLength "254", name "username", placeholder "username", _type "text",value state.username
, onInput \e -> dispatch (SetUserName (unsafeEventValue e))
] []
]
, div [className "form-group"]
[ input [className "form-control", _id "id_password", name "password", placeholder "password", _type "password",value state.password] []
[ input [className "form-control", _id "id_password", name "password", placeholder "password", _type "password",value state.password
,onInput \e -> dispatch (SetPassword (unsafeEventValue e))
] []
, div [className "clearfix"] []
]
, div [className "center"]
...
...
@@ -114,7 +126,7 @@ renderSpec = simpleSpec performAction render
, text "I accept the terms of uses",
a [href "http://gitlab.iscpif.fr/humanities/tofu/tree/master"] [text "[Read the terms of use]"]
]
, button [_id "login-button",className "btn btn-primary btn-rounded", _type "submit", onClick \_ -> dispatch $ Login] [text "Login
hello
"]
, button [_id "login-button",className "btn btn-primary btn-rounded", _type "submit", onClick \_ -> dispatch $ Login] [text "Login"]
]
]
]
...
...
@@ -127,6 +139,10 @@ renderSpec = simpleSpec performAction render
]
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
getDeviseID :: forall eff. Eff (dom :: DOM | eff) (Maybe String)
getDeviseID = do
...
...
@@ -160,7 +176,7 @@ loginReq encodeData =
let
setting =
defaultRequest
{ url = "http
s://dev
.gargantext.org/api/auth/token"
{ url = "http
://unstable
.gargantext.org/api/auth/token"
, method = Left POST
, headers =
[ ContentType applicationJSON
...
...
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