1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Merge pull request #28 from henrywright/27

Check if the nickname is valid before adding a CSS class
This commit is contained in:
marzavec 2018-07-29 17:29:13 -07:00 committed by GitHub
commit c06681803b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
const verifyNickname = (nick) => /^[a-zA-Z0-9_]{1,24}$/.test(nick);
var frontpage = [
" _ _ _ _ ",
" | |_ ___ ___| |_ ___| |_ ___| |_ ",
@ -157,7 +158,7 @@ function pushMessage(args) {
var messageEl = document.createElement('div');
messageEl.classList.add('message');
if (args.nick == myNick) {
if (verifyNickname(myNick) && args.nick == myNick) {
messageEl.classList.add('me');
} else if (args.nick == '!') {
messageEl.classList.add('warn');