mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
Added warning before changing username
This commit is contained in:
parent
8a0b93254b
commit
4c6ff2fff2
@ -2,6 +2,9 @@ import _ from 'underscore';
|
|||||||
import sanitizeHtml from 'sanitize-html';
|
import sanitizeHtml from 'sanitize-html';
|
||||||
import he from 'he';
|
import he from 'he';
|
||||||
|
|
||||||
|
// TODO: Remove in v2.0
|
||||||
|
let warned = false;
|
||||||
|
|
||||||
export default class Chat {
|
export default class Chat {
|
||||||
constructor(darkwire, socket) {
|
constructor(darkwire, socket) {
|
||||||
this.usernamesInMemory = [];
|
this.usernamesInMemory = [];
|
||||||
@ -168,6 +171,7 @@ export default class Chat {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
usage: '/nick {username}',
|
usage: '/nick {username}',
|
||||||
action: () => {
|
action: () => {
|
||||||
|
|
||||||
let newUsername = trigger.params[0] || false;
|
let newUsername = trigger.params[0] || false;
|
||||||
|
|
||||||
if (newUsername.toString().length > 16) {
|
if (newUsername.toString().length > 16) {
|
||||||
@ -181,6 +185,11 @@ export default class Chat {
|
|||||||
return this.log('Username must start with a letter.', {error: true});
|
return this.log('Username must start with a letter.', {error: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!warned) {
|
||||||
|
warned = true;
|
||||||
|
return this.log('Changing your username is currently in beta and your new username will be sent over the wire in plain text, unecrypted. This will be fixed in v2.0. If you really want to do this, type the command again.', {warning: true});
|
||||||
|
}
|
||||||
|
|
||||||
this.darkwire.updateUsername(newUsername).then((socketData) => {
|
this.darkwire.updateUsername(newUsername).then((socketData) => {
|
||||||
let modifiedSocketData = {
|
let modifiedSocketData = {
|
||||||
username: window.username,
|
username: window.username,
|
||||||
|
@ -140,12 +140,16 @@ describe('Darkwire', () => {
|
|||||||
before((client, done) => {
|
before((client, done) => {
|
||||||
browser.url('http://localhost:3000/' + testingRoom, () => {
|
browser.url('http://localhost:3000/' + testingRoom, () => {
|
||||||
browser.waitForElementPresent('ul.users li:nth-child(2)', 5000, () => {
|
browser.waitForElementPresent('ul.users li:nth-child(2)', 5000, () => {
|
||||||
|
browser.setValue('textarea.inputMessage', ['/nick rickAnsley', browser.Keys.RETURN], () => {
|
||||||
|
browser.waitForElementPresent('.log:last-child', 5000, () => {
|
||||||
browser.setValue('textarea.inputMessage', ['/nick rickAnsley', browser.Keys.RETURN], () => {
|
browser.setValue('textarea.inputMessage', ['/nick rickAnsley', browser.Keys.RETURN], () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Should change username', () => {
|
it('Should change username', () => {
|
||||||
browser.windowHandles((result) => {
|
browser.windowHandles((result) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user