mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
fix: disable forgotten password for external signin only (#6680)
- Make it such that `[service].ENABLE_INTERNAL_SIGNIN = false` disables the forgotten password prompt on the login page. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6680 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: davrot <davrot@noreply.codeberg.org> Co-committed-by: davrot <davrot@noreply.codeberg.org>
This commit is contained in:
parent
b1a7db7e28
commit
ef2fbc6093
3 changed files with 45 additions and 0 deletions
39
tests/integration/disable_forgotten_password_test.go
Normal file
39
tests/integration/disable_forgotten_password_test.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/tests"
|
||||
)
|
||||
|
||||
func TestDisableForgottenPasswordFalse(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, true)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user/login/")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", true)
|
||||
}
|
||||
|
||||
func TestDisableForgottenPasswordTrue(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
defer test.MockVariableValue(&setting.Service.EnableInternalSignIn, false)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user/login/")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", false)
|
||||
}
|
||||
|
||||
func TestDisableForgottenPasswordDefault(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user/login/")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "a[href='/user/forgot_password']", true)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue