forked from CringeStudios/gamja
Add "auth" parameter to tune connect form
This commit is contained in:
parent
6039e13411
commit
eef2093c88
@ -85,6 +85,11 @@ gamja default settings can be set using a `config.json` file at the root:
|
|||||||
"url": "wss://irc.example.org",
|
"url": "wss://irc.example.org",
|
||||||
// Channel(s) to auto-join (string or array of strings).
|
// Channel(s) to auto-join (string or array of strings).
|
||||||
"autojoin": "#gamja",
|
"autojoin": "#gamja",
|
||||||
|
// Controls how the password UI is presented to the user. Set to
|
||||||
|
// "mandatory" to require a password, "optional" to accept one but not
|
||||||
|
// require it, and "disabled" to never ask for a password. Defaults to
|
||||||
|
// "optional".
|
||||||
|
"auth": "optional",
|
||||||
// Interval in seconds to send PING commands (number). Set to 0 to
|
// Interval in seconds to send PING commands (number). Set to 0 to
|
||||||
// disable. Enabling PINGs can have an impact on client power usage and
|
// disable. Enabling PINGs can have an impact on client power usage and
|
||||||
// should only be enabled if necessary.
|
// should only be enabled if necessary.
|
||||||
|
@ -213,7 +213,12 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState((state) => {
|
this.setState((state) => {
|
||||||
return { connectParams: { ...state.connectParams, ...connectParams } };
|
return {
|
||||||
|
connectParams: {
|
||||||
|
...state.connectParams,
|
||||||
|
...connectParams,
|
||||||
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (connectParams.autoconnect) {
|
if (connectParams.autoconnect) {
|
||||||
@ -1203,6 +1208,7 @@ export default class App extends Component {
|
|||||||
<${ConnectForm}
|
<${ConnectForm}
|
||||||
error=${this.state.error}
|
error=${this.state.error}
|
||||||
params=${this.state.connectParams}
|
params=${this.state.connectParams}
|
||||||
|
auth=${this.config.server ? this.config.server.auth : null}
|
||||||
connecting=${connecting}
|
connecting=${connecting}
|
||||||
onSubmit=${this.handleConnectSubmit}
|
onSubmit=${this.handleConnectSubmit}
|
||||||
key=${this.state.connectParams}
|
key=${this.state.connectParams}
|
||||||
|
@ -98,6 +98,24 @@ export default class ConnectForm extends Component {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var auth = null;
|
||||||
|
if (this.props.auth !== "disabled") {
|
||||||
|
auth = html`
|
||||||
|
<label>
|
||||||
|
Password:<br/>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="password"
|
||||||
|
value=${this.state.password}
|
||||||
|
disabled=${disabled}
|
||||||
|
required=${this.props.auth === "mandatory"}
|
||||||
|
placeholder=${this.props.auth !== "mandatory" ? "(optional)" : ""}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<br/><br/>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<form onChange=${this.handleChange} onSubmit=${this.handleSubmit}>
|
<form onChange=${this.handleChange} onSubmit=${this.handleSubmit}>
|
||||||
<h2>Connect to IRC</h2>
|
<h2>Connect to IRC</h2>
|
||||||
@ -108,11 +126,7 @@ export default class ConnectForm extends Component {
|
|||||||
</label>
|
</label>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
<label>
|
${auth}
|
||||||
Password:<br/>
|
|
||||||
<input type="password" name="password" value=${this.state.password} disabled=${disabled}/>
|
|
||||||
</label>
|
|
||||||
<br/><br/>
|
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="rememberMe" checked=${this.state.rememberMe} disabled=${disabled}/>
|
<input type="checkbox" name="rememberMe" checked=${this.state.rememberMe} disabled=${disabled}/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user