mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-27 14:57:25 -05:00
Use label tag for chat username label, and rename javascript function to checkUsernameTooLong to better reflect its purpose
This commit is contained in:
parent
00473eaef6
commit
b66b5eca4d
@ -88,7 +88,7 @@ var emitMessage = function (socket) {
|
|||||||
|
|
||||||
var updateUsername = function (socket) {
|
var updateUsername = function (socket) {
|
||||||
var username = $('#username').val();
|
var username = $('#username').val();
|
||||||
if (!checkUsernameExists(username) && !checkUsernameLength(username)) {
|
if (!checkUsernameExists(username) && !checkUsernameTooLong(username)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `http://${document.domain}:${location.port}/update-session-username`,
|
url: `http://${document.domain}:${location.port}/update-session-username`,
|
||||||
@ -133,7 +133,7 @@ var checkUsernameExists = function (username) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkUsernameLength = function (username) {
|
var checkUsernameTooLong = function (username) {
|
||||||
$('#username-error').text('');
|
$('#username-error').text('');
|
||||||
if (username.length > 128) {
|
if (username.length > 128) {
|
||||||
$('#username-error').text('Please choose a shorter username.');
|
$('#username-error').text('Please choose a shorter username.');
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<div class="chat-container no-js">
|
<div class="chat-container no-js">
|
||||||
<div class="chat-users">
|
<div class="chat-users">
|
||||||
<div class="editable-username">
|
<div class="editable-username">
|
||||||
<p>Your username:</p>
|
<label for="username">Your username:</label>
|
||||||
<input id="username" value="{{ username }}" />
|
<input id="username" value="{{ username }}" />
|
||||||
<p id="username-error"></p>
|
<p id="username-error"></p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user