Dont send default server password to the client
This commit is contained in:
parent
1a7360a573
commit
2e8418516a
4 changed files with 28 additions and 13 deletions
|
@ -13,7 +13,7 @@ type connectDefaults struct {
|
|||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
Channels []string `json:"channels"`
|
||||
Password string `json:"password"`
|
||||
Password bool `json:"password"`
|
||||
SSL bool `json:"ssl"`
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ func getIndexData(r *http.Request, session *Session) *indexData {
|
|||
Name: viper.GetString("defaults.name"),
|
||||
Address: viper.GetString("defaults.address"),
|
||||
Channels: viper.GetStringSlice("defaults.channels"),
|
||||
Password: viper.GetString("defaults.password"),
|
||||
Password: viper.GetString("defaults.password") != "",
|
||||
SSL: viper.GetBool("defaults.ssl"),
|
||||
},
|
||||
Servers: servers,
|
||||
|
|
|
@ -97,6 +97,12 @@ func (h *wsHandler) connect(b []byte) {
|
|||
i.Password = data.Password
|
||||
i.Realname = data.Realname
|
||||
|
||||
if data.Password == "" && viper.GetString("defaults.password") != "" {
|
||||
i.Password = viper.GetString("defaults.password")
|
||||
} else {
|
||||
i.Password = data.Password
|
||||
}
|
||||
|
||||
if cert := h.session.user.GetCertificate(); cert != nil {
|
||||
i.TLSConfig = &tls.Config{
|
||||
Certificates: []tls.Certificate{*cert},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue