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 he from 'he';
|
||||
|
||||
// TODO: Remove in v2.0
|
||||
let warned = false;
|
||||
|
||||
export default class Chat {
|
||||
constructor(darkwire, socket) {
|
||||
this.usernamesInMemory = [];
|
||||
@ -168,6 +171,7 @@ export default class Chat {
|
||||
multiple: false,
|
||||
usage: '/nick {username}',
|
||||
action: () => {
|
||||
|
||||
let newUsername = trigger.params[0] || false;
|
||||
|
||||
if (newUsername.toString().length > 16) {
|
||||
@ -181,6 +185,11 @@ export default class Chat {
|
||||
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) => {
|
||||
let modifiedSocketData = {
|
||||
username: window.username,
|
||||
|
@ -140,12 +140,16 @@ describe('Darkwire', () => {
|
||||
before((client, done) => {
|
||||
browser.url('http://localhost:3000/' + testingRoom, () => {
|
||||
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], () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Should change username', () => {
|
||||
browser.windowHandles((result) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user