Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d16fd58b
Unverified
Commit
d16fd58b
authored
Jul 23, 2019
by
Oleg Gaidarenko
Committed by
GitHub
Jul 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auth: do not expose disabled user disabled status (#18229)
Fixes #17947
parent
4b16cd6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
pkg/api/login.go
+7
-3
pkg/api/login_oauth.go
+4
-1
No files found.
pkg/api/login.go
View file @
d16fd58b
...
...
@@ -81,7 +81,7 @@ func tryOAuthAutoLogin(c *models.ReqContext) bool {
}
oauthInfos
:=
setting
.
OAuthService
.
OAuthInfos
if
len
(
oauthInfos
)
!=
1
{
log
.
Warn
(
"Skipping OAuth auto login because multiple OAuth providers are configured
.
"
)
log
.
Warn
(
"Skipping OAuth auto login because multiple OAuth providers are configured"
)
return
false
}
for
key
:=
range
setting
.
OAuthService
.
OAuthInfos
{
...
...
@@ -114,12 +114,16 @@ func (hs *HTTPServer) LoginPost(c *models.ReqContext, cmd dtos.LoginCommand) Res
}
if
err
:=
bus
.
Dispatch
(
authQuery
);
err
!=
nil
{
e401
:=
Error
(
401
,
"Invalid username or password"
,
err
)
if
err
==
login
.
ErrInvalidCredentials
||
err
==
login
.
ErrTooManyLoginAttempts
{
return
Error
(
401
,
"Invalid username or password"
,
err
)
return
e401
}
// Do not expose disabled status,
// just show incorrect user credentials error (see #17947)
if
err
==
login
.
ErrUserDisabled
{
return
Error
(
401
,
"User is disabled"
,
err
)
hs
.
log
.
Warn
(
"User is disabled"
,
"user"
,
cmd
.
User
)
return
e401
}
return
Error
(
500
,
"Error while trying to authenticate user"
,
err
)
...
...
pkg/api/login_oauth.go
View file @
d16fd58b
...
...
@@ -191,8 +191,11 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) {
return
}
// Do not expose disabled status,
// just show incorrect user credentials error (see #17947)
if
cmd
.
Result
.
IsDisabled
{
hs
.
redirectWithError
(
ctx
,
login
.
ErrUserDisabled
)
oauthLogger
.
Warn
(
"User is disabled"
,
"user"
,
cmd
.
Result
.
Login
)
hs
.
redirectWithError
(
ctx
,
login
.
ErrInvalidCredentials
)
return
}
...
...
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