Skip to content

Commit fa7a18c

Browse files
committed
Merge branch 'v16' into 16-18
2 parents 09d5f7b + 5bb0c92 commit fa7a18c

File tree

4 files changed

+11
-60
lines changed

4 files changed

+11
-60
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ require (
9090
github.com/yuin/goldmark-meta v1.1.0
9191
go.jolheiser.com/hcaptcha v0.0.4
9292
go.jolheiser.com/pwn v0.0.3
93+
go.uber.org/atomic v1.9.0 // indirect
94+
go.uber.org/multierr v1.8.0 // indirect
95+
go.uber.org/zap v1.21.0 // indirect
9396
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
9497
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
9598
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b
@@ -265,9 +268,6 @@ require (
265268
go.etcd.io/etcd/tests/v3 v3.5.0-alpha.0 // indirect
266269
go.etcd.io/etcd/v3 v3.5.0-alpha.0 // indirect
267270
go.mongodb.org/mongo-driver v1.8.2 // indirect
268-
go.uber.org/atomic v1.9.0 // indirect
269-
go.uber.org/multierr v1.8.0 // indirect
270-
go.uber.org/zap v1.21.0 // indirect
271271
golang.org/x/mod v0.5.1 // indirect
272272
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
273273
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect

modules/ssh/ssh.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -317,64 +317,7 @@ func Listen(host string, port int, ciphers, keyExchanges, macs []string) {
317317
}
318318
}
319319

320-
// Workaround slightly broken behaviour in x/crypto/ssh/handshake.go:458-463
321-
//
322-
// Fundamentally the issue here is that HostKeyAlgos make the incorrect assumption
323-
// that the PublicKey().Type() matches the signature algorithm.
324-
//
325-
// Therefore we need to add duplicates for the RSA with different signing algorithms.
326-
signers := make([]ssh.Signer, 0, len(srv.HostSigners))
327-
for _, signer := range srv.HostSigners {
328-
if signer.PublicKey().Type() == "ssh-rsa" {
329-
signers = append(signers,
330-
&wrapSigner{
331-
Signer: signer,
332-
algorithm: gossh.SigAlgoRSASHA2512,
333-
},
334-
&wrapSigner{
335-
Signer: signer,
336-
algorithm: gossh.SigAlgoRSASHA2256,
337-
},
338-
)
339-
}
340-
signers = append(signers, signer)
341-
}
342-
srv.HostSigners = signers
343-
344320
go listen(&srv)
345-
346-
}
347-
348-
// wrapSigner wraps a signer and overrides its public key type with the provided algorithm
349-
type wrapSigner struct {
350-
ssh.Signer
351-
algorithm string
352-
}
353-
354-
// PublicKey returns an associated PublicKey instance.
355-
func (s *wrapSigner) PublicKey() gossh.PublicKey {
356-
return &wrapPublicKey{
357-
PublicKey: s.Signer.PublicKey(),
358-
algorithm: s.algorithm,
359-
}
360-
}
361-
362-
// Sign returns raw signature for the given data. This method
363-
// will apply the hash specified for the keytype to the data using
364-
// the algorithm assigned for this key
365-
func (s *wrapSigner) Sign(rand io.Reader, data []byte) (*gossh.Signature, error) {
366-
return s.Signer.(gossh.AlgorithmSigner).SignWithAlgorithm(rand, data, s.algorithm)
367-
}
368-
369-
// wrapPublicKey wraps a PublicKey and overrides its type
370-
type wrapPublicKey struct {
371-
gossh.PublicKey
372-
algorithm string
373-
}
374-
375-
// Type returns the algorithm
376-
func (k *wrapPublicKey) Type() string {
377-
return k.algorithm
378321
}
379322

380323
// GenKeyPair make a pair of public and private keys for SSH access.

routers/web/auth/auth.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth.
621621

622622
// Send confirmation email
623623
if !u.IsActive && u.ID > 1 {
624+
if setting.Service.RegisterManualConfirm {
625+
ctx.Data["ManualActivationOnly"] = true
626+
ctx.HTML(http.StatusOK, TplActivate)
627+
return
628+
}
629+
624630
mailer.SendActivateAccountMail(ctx.Locale, u)
625631

626632
ctx.Data["IsSendRegisterMail"] = true

templates/user/auth/activate.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" (.Email|Escape) .ActiveCodeLives | Str2html}}</p>
3333
{{else if .IsActivateFailed}}
3434
<p>{{.i18n.Tr "auth.invalid_code"}}</p>
35+
{{else if .ManualActivationOnly}}
36+
<p class="center">{{.i18n.Tr "auth.disable_register_mail"}}</p>
3537
{{else}}
3638
<p>{{.i18n.Tr "auth.has_unconfirmed_mail" (.SignedUser.Name|Escape) (.SignedUser.Email|Escape) | Str2html}}</p>
3739
<div class="ui divider"></div>

0 commit comments

Comments
 (0)