mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Check if the nickname is valid before adding a CSS class
This commit is contained in:
parent
8b86f3a8f4
commit
bce848f8a3
|
@ -1,3 +1,4 @@
|
||||||
|
const verifyNickname = (nick) => /^[a-zA-Z0-9_]{1,24}$/.test(nick);
|
||||||
var frontpage = [
|
var frontpage = [
|
||||||
" _ _ _ _ ",
|
" _ _ _ _ ",
|
||||||
" | |_ ___ ___| |_ ___| |_ ___| |_ ",
|
" | |_ ___ ___| |_ ___| |_ ___| |_ ",
|
||||||
|
@ -157,7 +158,7 @@ function pushMessage(args) {
|
||||||
var messageEl = document.createElement('div');
|
var messageEl = document.createElement('div');
|
||||||
messageEl.classList.add('message');
|
messageEl.classList.add('message');
|
||||||
|
|
||||||
if (args.nick == myNick) {
|
if (verifyNickname(myNick) && args.nick == myNick) {
|
||||||
messageEl.classList.add('me');
|
messageEl.classList.add('me');
|
||||||
} else if (args.nick == '!') {
|
} else if (args.nick == '!') {
|
||||||
messageEl.classList.add('warn');
|
messageEl.classList.add('warn');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user