fix the textscramble for sessionID on registration (#753)

fix the textscramble for sessionID on registration
pull/761/head
Audric Ackermann 6 years ago committed by GitHub
commit caad2c31ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -51,12 +51,12 @@
class TextScramble { class TextScramble {
constructor(el) { constructor(el) {
this.el = el; this.el = el;
this.chars = '0123456789qwertyuiopasdfghjklzxcvbnm'; this.chars = '0123456789abcdef';
this.update = this.update.bind(this); this.update = this.update.bind(this);
} }
setText(newText) { setText(newText) {
const oldText = this.el.innerText; const oldText = this.el.value;
const length = Math.max(oldText.length, newText.length); const length = Math.max(oldText.length, newText.length);
// eslint-disable-next-line no-return-assign // eslint-disable-next-line no-return-assign
const promise = new Promise(resolve => (this.resolve = resolve)); const promise = new Promise(resolve => (this.resolve = resolve));
@ -97,14 +97,13 @@
char = this.randomChar(); char = this.randomChar();
this.queue[i].char = char; this.queue[i].char = char;
} }
output += char;
output += `<span class="dud">${char}</span>`;
} else { } else {
output += from; output += from;
} }
} }
this.el.innerHTML = output; this.el.value = output;
if (complete === this.queue.length) { if (complete === this.queue.length) {
this.resolve(); this.resolve();
@ -123,7 +122,7 @@
window.Session.setNewSessionID = sessionID => { window.Session.setNewSessionID = sessionID => {
const el = document.querySelector('.session-id-editable'); const el = document.querySelector('.session-id-editable');
const fx = new TextScramble(el); const fx = new TextScramble(el);
el.innerHTML = sessionID; el.value = sessionID;
fx.setText(sessionID); fx.setText(sessionID);
}; };
})(); })();

@ -1323,6 +1323,12 @@ label {
border-color: $session-color-white; border-color: $session-color-white;
} }
} }
.session-id-editable {
resize: none;
overflow: hidden;
}
.user-details-dialog { .user-details-dialog {
.session-id-editable { .session-id-editable {
width: 30vh; width: 30vh;

Loading…
Cancel
Save