Add AppURL without trailing slash to TOTP issuer parameter to prevent conflicting accounts on multiple gitea installations (#2335)
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
This commit is contained in:
parent
4c13a8458b
commit
5707ad3bb7
|
@ -583,7 +583,7 @@ func twofaGenerateSecretAndQr(ctx *context.Context) bool {
|
||||||
if otpKey == nil {
|
if otpKey == nil {
|
||||||
err = nil // clear the error, in case the URL was invalid
|
err = nil // clear the error, in case the URL was invalid
|
||||||
otpKey, err = totp.Generate(totp.GenerateOpts{
|
otpKey, err = totp.Generate(totp.GenerateOpts{
|
||||||
Issuer: setting.AppName,
|
Issuer: setting.AppName + " (" + strings.TrimRight(setting.AppURL, "/") + ")",
|
||||||
AccountName: ctx.User.Name,
|
AccountName: ctx.User.Name,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue