Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
gargantext
haskell-gargantext
Commits
37d418f2
Commit
37d418f2
authored
Mar 30, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Username could be email
parent
87420e23
Pipeline
#3838
failed with stage
in 31 minutes and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
gargantext.cabal
gargantext.cabal
+2
-2
Auth.hs
src/Gargantext/API/Admin/Auth.hs
+10
-3
No files found.
gargantext.cabal
View file @
37d418f2
...
@@ -5,7 +5,7 @@ cabal-version: 1.12
...
@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
-- see: https://github.com/sol/hpack
name: gargantext
name: gargantext
version: 0.0.6.9.8.
2.2
version: 0.0.6.9.8.
3
synopsis: Search, map, share
synopsis: Search, map, share
description: Please see README.md
description: Please see README.md
category: Data
category: Data
...
@@ -45,8 +45,8 @@ library
...
@@ -45,8 +45,8 @@ library
Gargantext.API.Node.Share
Gargantext.API.Node.Share
Gargantext.API.Prelude
Gargantext.API.Prelude
Gargantext.Core
Gargantext.Core
Gargantext.Core.Methods.Similarities
Gargantext.Core.NLP
Gargantext.Core.NLP
Gargantext.Core.Methods.Similarities
Gargantext.Core.NodeStory
Gargantext.Core.NodeStory
Gargantext.Core.Text
Gargantext.Core.Text
Gargantext.Core.Text.Context
Gargantext.Core.Text.Context
...
...
src/Gargantext/API/Admin/Auth.hs
View file @
37d418f2
...
@@ -60,6 +60,7 @@ import Gargantext.Database.Prelude (Cmd', CmdM, CmdCommon)
...
@@ -60,6 +60,7 @@ import Gargantext.Database.Prelude (Cmd', CmdM, CmdCommon)
import
Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Tree
(
isDescendantOf
,
isIn
)
import
Gargantext.Database.Query.Tree
(
isDescendantOf
,
isIn
)
import
Gargantext.Database.Query.Tree.Root
(
getRoot
)
import
Gargantext.Database.Query.Tree.Root
(
getRoot
)
import
Gargantext.Database.Action.User.New
(
guessUserName
)
import
Gargantext.Database.Schema.Node
(
NodePoly
(
_node_id
))
import
Gargantext.Database.Schema.Node
(
NodePoly
(
_node_id
))
import
Gargantext.Prelude
hiding
(
reverse
)
import
Gargantext.Prelude
hiding
(
reverse
)
import
Gargantext.Prelude.Crypto.Pass.User
(
gargPass
)
import
Gargantext.Prelude.Crypto.Pass.User
(
gargPass
)
...
@@ -87,15 +88,21 @@ checkAuthRequest :: ( HasSettings env, CmdCommon env, HasJoseError err)
...
@@ -87,15 +88,21 @@ checkAuthRequest :: ( HasSettings env, CmdCommon env, HasJoseError err)
=>
Username
=>
Username
->
GargPassword
->
GargPassword
->
Cmd'
env
err
CheckAuth
->
Cmd'
env
err
CheckAuth
checkAuthRequest
u
(
GargPassword
p
)
=
do
checkAuthRequest
couldBeEmail
(
GargPassword
p
)
=
do
candidate
<-
head
<$>
getUsersWith
u
-- Sometimes user put email instead of username
-- hence we have to check before
let
usrname
=
case
guessUserName
couldBeEmail
of
Nothing
->
couldBeEmail
-- we are sure this is not an email
Just
(
u
,
_
)
->
u
-- this was an email in fact
candidate
<-
head
<$>
getUsersWith
usrname
case
candidate
of
case
candidate
of
Nothing
->
pure
InvalidUser
Nothing
->
pure
InvalidUser
Just
(
UserLight
{
userLight_password
=
GargPassword
h
,
..
})
->
Just
(
UserLight
{
userLight_password
=
GargPassword
h
,
..
})
->
case
Auth
.
checkPassword
(
Auth
.
mkPassword
p
)
(
Auth
.
PasswordHash
h
)
of
case
Auth
.
checkPassword
(
Auth
.
mkPassword
p
)
(
Auth
.
PasswordHash
h
)
of
Auth
.
PasswordCheckFail
->
pure
InvalidPassword
Auth
.
PasswordCheckFail
->
pure
InvalidPassword
Auth
.
PasswordCheckSuccess
->
do
Auth
.
PasswordCheckSuccess
->
do
muId
<-
head
<$>
getRoot
(
UserName
u
)
muId
<-
head
<$>
getRoot
(
UserName
u
srname
)
case
_node_id
<$>
muId
of
case
_node_id
<$>
muId
of
Nothing
->
pure
InvalidUser
Nothing
->
pure
InvalidUser
Just
uid
->
do
Just
uid
->
do
...
...
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