Dont send default server password to the client
This commit is contained in:
parent
1a7360a573
commit
2e8418516a
File diff suppressed because one or more lines are too long
@ -9,7 +9,8 @@ import { select } from '../actions/tab';
|
||||
@pure
|
||||
class Connect extends Component {
|
||||
state = {
|
||||
showOptionals: false
|
||||
showOptionals: false,
|
||||
passwordTouched: false
|
||||
};
|
||||
|
||||
handleSubmit = (e) => {
|
||||
@ -27,8 +28,11 @@ class Connect extends Component {
|
||||
if (this.state.showOptionals) {
|
||||
opts.realname = e.target.realname.value.trim();
|
||||
opts.username = e.target.username.value.trim();
|
||||
|
||||
if (this.state.passwordTouched) {
|
||||
opts.password = e.target.password.value.trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (address.indexOf('.') > 0 && nick) {
|
||||
dispatch(serverActions.connect(address, nick, opts));
|
||||
@ -50,6 +54,10 @@ class Connect extends Component {
|
||||
this.setState({ showOptionals: !this.state.showOptionals });
|
||||
};
|
||||
|
||||
handlePasswordChange = () => {
|
||||
this.setState({ passwordTouched: true });
|
||||
};
|
||||
|
||||
render() {
|
||||
const defaults = window.__ENV__.defaults;
|
||||
let optionals = null;
|
||||
@ -62,7 +70,8 @@ class Connect extends Component {
|
||||
name="password"
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
defaultValue={defaults.password}
|
||||
defaultValue={defaults.password ? ' ' : null}
|
||||
onChange={this.handlePasswordChange}
|
||||
/>
|
||||
<input name="realname" type="text" placeholder="Realname" />
|
||||
</div>
|
||||
|
@ -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…
Reference in New Issue
Block a user