Skip to content

Commit ac2ed8d

Browse files
authored
Merge branch 'main' into fix-update-issues-commit
2 parents f5f6545 + 622f1e7 commit ac2ed8d

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

modules/references/references.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package references
66

77
import (
8+
"bytes"
89
"net/url"
910
"regexp"
1011
"strconv"
@@ -14,6 +15,8 @@ import (
1415
"code.gitea.io/gitea/modules/log"
1516
"code.gitea.io/gitea/modules/markup/mdstripper"
1617
"code.gitea.io/gitea/modules/setting"
18+
19+
"github.com/yuin/goldmark/util"
1720
)
1821

1922
var (
@@ -321,7 +324,7 @@ func FindRenderizableReferenceNumeric(content string, prOnly bool) (bool, *Rende
321324
return false, nil
322325
}
323326
}
324-
r := getCrossReference([]byte(content), match[2], match[3], false, prOnly)
327+
r := getCrossReference(util.StringToReadOnlyBytes(content), match[2], match[3], false, prOnly)
325328
if r == nil {
326329
return false, nil
327330
}
@@ -465,18 +468,17 @@ func findAllIssueReferencesBytes(content []byte, links []string) []*rawReference
465468
}
466469

467470
func getCrossReference(content []byte, start, end int, fromLink bool, prOnly bool) *rawReference {
468-
refid := string(content[start:end])
469-
sep := strings.IndexAny(refid, "#!")
471+
sep := bytes.IndexAny(content[start:end], "#!")
470472
if sep < 0 {
471473
return nil
472474
}
473-
isPull := refid[sep] == '!'
475+
isPull := content[start+sep] == '!'
474476
if prOnly && !isPull {
475477
return nil
476478
}
477-
repo := refid[:sep]
478-
issue := refid[sep+1:]
479-
index, err := strconv.ParseInt(issue, 10, 64)
479+
repo := string(content[start : start+sep])
480+
issue := string(content[start+sep+1 : end])
481+
index, err := strconv.ParseInt(string(issue), 10, 64)
480482
if err != nil {
481483
return nil
482484
}

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new
303303
openid_register_title = Create new account
304304
openid_register_desc = The chosen OpenID URI is unknown. Associate it with a new account here.
305305
openid_signin_desc = Enter your OpenID URI. For example: https://anne.me, bob.openid.org.cn or gnusocial.net/carry.
306-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
306+
disable_forgot_password_mail = Account recovery is disabled because no email is set up. Please contact your site administrator.
307+
disable_forgot_password_mail_admin = Account recovery is only available when email is set up. Please set up email to enable account recovery.
307308
email_domain_blacklisted = You cannot register with your email address.
308309
authorize_application = Authorize Application
309310
authorize_redirect_notice = You will be redirected to %s if you authorize this application.
@@ -312,7 +313,6 @@ authorize_application_description = If you grant the access, it will be able to
312313
authorize_title = Authorize "%s" to access your account?
313314
authorization_failed = Authorization failed
314315
authorization_failed_desc = The authorization failed because we detected an invalid request. Please contact the maintainer of the app you've tried to authorize.
315-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
316316
sspi_auth_failed = SSPI authentication failed
317317
password_pwned = The password you chose is on a <a target="_blank" rel="noopener noreferrer" href="https://haveibeenpwned.com/Passwords">list of stolen passwords</a> previously exposed in public data breaches. Please try again with a different password.
318318
password_pwned_err = Could not complete request to HaveIBeenPwned

routers/web/user/auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,7 @@ func ForgotPasswd(ctx *context.Context) {
14781478
ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title")
14791479

14801480
if setting.MailService == nil {
1481+
log.Warn(ctx.Tr("auth.disable_forgot_password_mail_admin"))
14811482
ctx.Data["IsResetDisable"] = true
14821483
ctx.HTML(http.StatusOK, tplForgotPassword)
14831484
return

templates/user/auth/forgot_passwd.tmpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
<button class="ui blue button">{{.i18n.Tr "auth.send_reset_mail"}}</button>
2323
</div>
2424
{{else if .IsResetDisable}}
25-
<p class="center">{{.i18n.Tr "auth.disable_forgot_password_mail"}}</p>
25+
<p class="center">
26+
{{if $.IsAdmin}}
27+
{{.i18n.Tr "auth.disable_forgot_password_mail_admin"}}
28+
{{else}}
29+
{{.i18n.Tr "auth.disable_forgot_password_mail"}}
30+
{{end}}
31+
</p>
2632
{{else if .ResendLimited}}
2733
<p class="center">{{.i18n.Tr "auth.resent_limit_prompt"}}</p>
2834
{{end}}

0 commit comments

Comments
 (0)