mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-25 00:38:12 -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.handleAuthSubmit = this.handleAuthSubmit.bind(this);
|
||||
this.handleRegisterSubmit = this.handleRegisterSubmit.bind(this);
|
||||
this.handleVerifyClick = this.handleVerifyClick.bind(this);
|
||||
this.handleVerifySubmit = this.handleVerifySubmit.bind(this);
|
||||
|
||||
this.saveReceipts = debounce(this.saveReceipts.bind(this), 500);
|
||||
|
@ -1443,7 +1444,7 @@ export default class App extends Component {
|
|||
this.dismissDialog();
|
||||
|
||||
if (data.verificationRequired) {
|
||||
this.openDialog("verify", data);
|
||||
this.handleVerifyClick(data.account, data.message);
|
||||
}
|
||||
|
||||
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) {
|
||||
let serverID = State.getActiveServerID(this.state);
|
||||
let client = this.clients.get(serverID);
|
||||
|
@ -1737,6 +1742,7 @@ export default class App extends Component {
|
|||
onNickClick=${this.handleNickClick}
|
||||
onAuthClick=${() => this.handleAuthClick(activeBuffer.server)}
|
||||
onRegisterClick=${() => this.handleRegisterClick(activeBuffer.server)}
|
||||
onVerifyClick=${this.handleVerifyClick}
|
||||
/>
|
||||
</section>
|
||||
</>
|
||||
|
|
|
@ -77,6 +77,8 @@ class LogLine extends Component {
|
|||
|
||||
let onNickClick = this.props.onNickClick;
|
||||
let onChannelClick = this.props.onChannelClick;
|
||||
let onVerifyClick = this.props.onVerifyClick;
|
||||
|
||||
function createNick(nick) {
|
||||
return html`
|
||||
<${Nick} nick=${nick} onClick=${() => onNickClick(nick)}/>
|
||||
|
@ -213,13 +215,19 @@ class LogLine extends Component {
|
|||
break;
|
||||
case "REGISTER":
|
||||
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]) {
|
||||
case "SUCCESS":
|
||||
content = html`A new account has been created, you are now authenticated as ${account}`;
|
||||
break;
|
||||
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;
|
||||
|
@ -577,6 +585,8 @@ export default class Buffer extends Component {
|
|||
|
||||
let onChannelClick = this.props.onChannelClick;
|
||||
let onNickClick = this.props.onNickClick;
|
||||
let onVerifyClick = this.props.onVerifyClick;
|
||||
|
||||
function createLogLine(msg) {
|
||||
return html`
|
||||
<${LogLine}
|
||||
|
@ -586,6 +596,7 @@ export default class Buffer extends Component {
|
|||
server=${server}
|
||||
onChannelClick=${onChannelClick}
|
||||
onNickClick=${onNickClick}
|
||||
onVerifyClick=${onVerifyClick}
|
||||
/>
|
||||
`;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue