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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
-- see: https://github.com/sol/hpack
name: gargantext
version: 0.0.6.9.8.
2.2
version: 0.0.6.9.8.
3
synopsis: Search, map, share
description: Please see README.md
category: Data
...
...
@@ -45,8 +45,8 @@ library
Gargantext.API.Node.Share
Gargantext.API.Prelude
Gargantext.Core
Gargantext.Core.Methods.Similarities
Gargantext.Core.NLP
Gargantext.Core.Methods.Similarities
Gargantext.Core.NodeStory
Gargantext.Core.Text
Gargantext.Core.Text.Context
...
...
src/Gargantext/API/Admin/Auth.hs
View file @
37d418f2
...
...
@@ -60,6 +60,7 @@ import Gargantext.Database.Prelude (Cmd', CmdM, CmdCommon)
import
Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Tree
(
isDescendantOf
,
isIn
)
import
Gargantext.Database.Query.Tree.Root
(
getRoot
)
import
Gargantext.Database.Action.User.New
(
guessUserName
)
import
Gargantext.Database.Schema.Node
(
NodePoly
(
_node_id
))
import
Gargantext.Prelude
hiding
(
reverse
)
import
Gargantext.Prelude.Crypto.Pass.User
(
gargPass
)
...
...
@@ -87,15 +88,21 @@ checkAuthRequest :: ( HasSettings env, CmdCommon env, HasJoseError err)
=>
Username
->
GargPassword
->
Cmd'
env
err
CheckAuth
checkAuthRequest
u
(
GargPassword
p
)
=
do
candidate
<-
head
<$>
getUsersWith
u
checkAuthRequest
couldBeEmail
(
GargPassword
p
)
=
do
-- 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
Nothing
->
pure
InvalidUser
Just
(
UserLight
{
userLight_password
=
GargPassword
h
,
..
})
->
case
Auth
.
checkPassword
(
Auth
.
mkPassword
p
)
(
Auth
.
PasswordHash
h
)
of
Auth
.
PasswordCheckFail
->
pure
InvalidPassword
Auth
.
PasswordCheckSuccess
->
do
muId
<-
head
<$>
getRoot
(
UserName
u
)
muId
<-
head
<$>
getRoot
(
UserName
u
srname
)
case
_node_id
<$>
muId
of
Nothing
->
pure
InvalidUser
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