mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-28 18:26:19 -05:00
Add link to verify account next to VERIFICATION_REQUIRED message
This commit is contained in:
parent
be08302c1f
commit
451bb4c73f
2 changed files with 20 additions and 3 deletions
|
@ -196,6 +196,7 @@ export default class App extends Component {
|
||||||
this.handleDismissError = this.handleDismissError.bind(this);
|
this.handleDismissError = this.handleDismissError.bind(this);
|
||||||
this.handleAuthSubmit = this.handleAuthSubmit.bind(this);
|
this.handleAuthSubmit = this.handleAuthSubmit.bind(this);
|
||||||
this.handleRegisterSubmit = this.handleRegisterSubmit.bind(this);
|
this.handleRegisterSubmit = this.handleRegisterSubmit.bind(this);
|
||||||
|
this.handleVerifyClick = this.handleVerifyClick.bind(this);
|
||||||
this.handleVerifySubmit = this.handleVerifySubmit.bind(this);
|
this.handleVerifySubmit = this.handleVerifySubmit.bind(this);
|
||||||
|
|
||||||
this.saveReceipts = debounce(this.saveReceipts.bind(this), 500);
|
this.saveReceipts = debounce(this.saveReceipts.bind(this), 500);
|
||||||
|
@ -1443,7 +1444,7 @@ export default class App extends Component {
|
||||||
this.dismissDialog();
|
this.dismissDialog();
|
||||||
|
|
||||||
if (data.verificationRequired) {
|
if (data.verificationRequired) {
|
||||||
this.openDialog("verify", data);
|
this.handleVerifyClick(data.account, data.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
let firstClient = this.clients.values().next().value;
|
let firstClient = this.clients.values().next().value;
|
||||||
|
@ -1465,6 +1466,10 @@ export default class App extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleVerifyClick(account, message) {
|
||||||
|
this.openDialog("verify", { account, message });
|
||||||
|
}
|
||||||
|
|
||||||
handleVerifySubmit(code) {
|
handleVerifySubmit(code) {
|
||||||
let serverID = State.getActiveServerID(this.state);
|
let serverID = State.getActiveServerID(this.state);
|
||||||
let client = this.clients.get(serverID);
|
let client = this.clients.get(serverID);
|
||||||
|
@ -1737,6 +1742,7 @@ export default class App extends Component {
|
||||||
onNickClick=${this.handleNickClick}
|
onNickClick=${this.handleNickClick}
|
||||||
onAuthClick=${() => this.handleAuthClick(activeBuffer.server)}
|
onAuthClick=${() => this.handleAuthClick(activeBuffer.server)}
|
||||||
onRegisterClick=${() => this.handleRegisterClick(activeBuffer.server)}
|
onRegisterClick=${() => this.handleRegisterClick(activeBuffer.server)}
|
||||||
|
onVerifyClick=${this.handleVerifyClick}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -77,6 +77,8 @@ class LogLine extends Component {
|
||||||
|
|
||||||
let onNickClick = this.props.onNickClick;
|
let onNickClick = this.props.onNickClick;
|
||||||
let onChannelClick = this.props.onChannelClick;
|
let onChannelClick = this.props.onChannelClick;
|
||||||
|
let onVerifyClick = this.props.onVerifyClick;
|
||||||
|
|
||||||
function createNick(nick) {
|
function createNick(nick) {
|
||||||
return html`
|
return html`
|
||||||
<${Nick} nick=${nick} onClick=${() => onNickClick(nick)}/>
|
<${Nick} nick=${nick} onClick=${() => onNickClick(nick)}/>
|
||||||
|
@ -213,13 +215,19 @@ class LogLine extends Component {
|
||||||
break;
|
break;
|
||||||
case "REGISTER":
|
case "REGISTER":
|
||||||
account = msg.params[1];
|
account = msg.params[1];
|
||||||
let reason = linkify(msg.params[2]);
|
let reason = msg.params[2];
|
||||||
|
|
||||||
|
function handleVerifyClick(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
onVerifyClick(account, reason);
|
||||||
|
}
|
||||||
|
|
||||||
switch (msg.params[0]) {
|
switch (msg.params[0]) {
|
||||||
case "SUCCESS":
|
case "SUCCESS":
|
||||||
content = html`A new account has been created, you are now authenticated as ${account}`;
|
content = html`A new account has been created, you are now authenticated as ${account}`;
|
||||||
break;
|
break;
|
||||||
case "VERIFICATION_REQUIRED":
|
case "VERIFICATION_REQUIRED":
|
||||||
content = html`A new account has been created, but further action is required to complete registration: ${reason}`;
|
content = html`A new account has been created, but you need to <a href="#" onClick=${handleVerifyClick}>verify it</a>: ${linkify(reason)}`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -577,6 +585,8 @@ export default class Buffer extends Component {
|
||||||
|
|
||||||
let onChannelClick = this.props.onChannelClick;
|
let onChannelClick = this.props.onChannelClick;
|
||||||
let onNickClick = this.props.onNickClick;
|
let onNickClick = this.props.onNickClick;
|
||||||
|
let onVerifyClick = this.props.onVerifyClick;
|
||||||
|
|
||||||
function createLogLine(msg) {
|
function createLogLine(msg) {
|
||||||
return html`
|
return html`
|
||||||
<${LogLine}
|
<${LogLine}
|
||||||
|
@ -586,6 +596,7 @@ export default class Buffer extends Component {
|
||||||
server=${server}
|
server=${server}
|
||||||
onChannelClick=${onChannelClick}
|
onChannelClick=${onChannelClick}
|
||||||
onNickClick=${onNickClick}
|
onNickClick=${onNickClick}
|
||||||
|
onVerifyClick=${onVerifyClick}
|
||||||
/>
|
/>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue