Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/context/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package context

import (
"net/http"
"strings"

"code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/modules/log"
Expand Down Expand Up @@ -41,6 +42,10 @@ func Toggle(options *ToggleOptions) func(ctx *Context) {

if ctx.Doer.MustChangePassword {
if ctx.Req.URL.Path != "/user/settings/change_password" {
if strings.HasPrefix(ctx.Req.UserAgent(), "git") {
ctx.Error(http.StatusUnauthorized, ctx.Tr("auth.must_change_password"))
return
}
ctx.Data["Title"] = ctx.Tr("auth.must_change_password")
ctx.Data["ChangePasscodeLink"] = setting.AppSubURL + "/user/change_password"
if ctx.Req.URL.Path != "/user/events" {
Expand Down