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
47419726
Commit
47419726
authored
Nov 29, 2018
by
SilverFire - Dmitry Naumenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent password reset when login form is disabled or either LDAP or Auth Proxy is enabled
parent
d16b3488
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
pkg/api/password.go
+8
-0
public/app/partials/reset_password.html
+8
-1
No files found.
pkg/api/password.go
View file @
47419726
...
@@ -4,10 +4,18 @@ import (
...
@@ -4,10 +4,18 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util"
)
)
func
SendResetPasswordEmail
(
c
*
m
.
ReqContext
,
form
dtos
.
SendResetPasswordEmailForm
)
Response
{
func
SendResetPasswordEmail
(
c
*
m
.
ReqContext
,
form
dtos
.
SendResetPasswordEmailForm
)
Response
{
if
setting
.
LdapEnabled
||
setting
.
AuthProxyEnabled
{
return
Error
(
401
,
"Not allowed to reset password when LDAP or Auth Proxy is enabled"
,
nil
)
}
if
setting
.
DisableLoginForm
{
return
Error
(
401
,
"Not allowed to reset password when login form is disabled"
,
nil
)
}
userQuery
:=
m
.
GetUserByLoginQuery
{
LoginOrEmail
:
form
.
UserOrEmail
}
userQuery
:=
m
.
GetUserByLoginQuery
{
LoginOrEmail
:
form
.
UserOrEmail
}
if
err
:=
bus
.
Dispatch
(
&
userQuery
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
(
&
userQuery
);
err
!=
nil
{
...
...
public/app/partials/reset_password.html
View file @
47419726
...
@@ -3,7 +3,14 @@
...
@@ -3,7 +3,14 @@
<div
class=
"page-container page-body"
>
<div
class=
"page-container page-body"
>
<div
class=
"signup"
>
<div
class=
"signup"
>
<h3
class=
"p-b-1"
>
Reset password
</h3>
<h3
class=
"p-b-1"
>
Reset password
</h3>
<form
name=
"sendResetForm"
class=
"login-form gf-form-group"
ng-show=
"mode === 'send'"
>
<div
ng-if=
"ldapEnabled || authProxyEnabled"
>
You cannot reset password when LDAP or Auth Proxy authentication is enabled.
</div>
<div
ng-if=
"disableLoginForm"
>
You cannot reset password when login form is disabled.
</div>
<form
name=
"sendResetForm"
class=
"login-form gf-form-group"
ng-show=
"mode === 'send'"
ng-hide=
"ldapEnabled || authProxyEnabled || disableLoginForm"
>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-7"
>
User
</span>
<span
class=
"gf-form-label width-7"
>
User
</span>
<input
type=
"text"
name=
"username"
class=
"gf-form-input max-width-14"
required
ng-model=
'formModel.userOrEmail'
placeholder=
"email or username"
>
<input
type=
"text"
name=
"username"
class=
"gf-form-input max-width-14"
required
ng-model=
'formModel.userOrEmail'
placeholder=
"email or username"
>
...
...
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