Adds room name validation logic for web.

This commit is contained in:
damencho 2019-10-14 16:17:54 +01:00 committed by Дамян Минков
parent a4cbbccb2a
commit f46387a226
3 changed files with 46 additions and 14 deletions

View File

@ -19,29 +19,37 @@ server {
ssl_certificate_key /etc/jitsi/meet/jitsi-meet.example.com.key;
root /usr/share/jitsi-meet;
ssi on;
index index.html index.htm;
error_page 404 /static/404.html;
location /config.js {
location = /config.js {
alias /etc/jitsi/meet/jitsi-meet.example.com-config.js;
}
location /external_api.js {
location = /external_api.js {
alias /usr/share/jitsi-meet/libs/external_api.min.js;
}
location ~ ^/([a-zA-Z0-9=\?]+)$ {
rewrite ^/(.*)$ / break;
}
location / {
ssi on;
#ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$
{
add_header 'Access-Control-Allow-Origin' '*';
alias /usr/share/jitsi-meet/$1/$2;
}
# BOSH
location /http-bind {
location = /http-bind {
proxy_pass http://localhost:5280/http-bind;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location ~ ^/([^?&:’“]+)$ {
try_files $uri @root_path;
}
location @root_path {
rewrite ^/(.*)$ / break;
}
}

View File

@ -725,7 +725,7 @@
"connectCalendarButton": "Connect your calendar",
"connectCalendarText": "Connect your calendar to view all your meetings in {{app}}. Plus, add {{provider}} meetings to your calendar and start them with one click.",
"enterRoomTitle": "Start a new meeting",
"onlyAsciiAllowed": "Meeting name should only contain latin characters and numbers.",
"roomNameAllowedChars": "Meeting name should not contain any of these characters: ?, &, :, ', \", %, #.",
"go": "GO",
"join": "JOIN",
"info": "Info",

View File

@ -12,6 +12,12 @@ import { SettingsButton, SETTINGS_TABS } from '../../settings';
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
import Tabs from './Tabs';
/**
* The pattern used to validate room name.
* @type {string}
*/
export const ROOM_NAME_VALIDATE_PATTERN_STR = '^[^?&:\u0022\u0027%#]+$';
/**
* The Web container rendering the welcome page.
*
@ -53,6 +59,8 @@ class WelcomePage extends AbstractWelcomePage {
*/
this._additionalContentRef = null;
this._roomInputRef = null;
/**
* The HTML Element used as the container for additional toolbar content. Used
* for directly appending the additional content template to the dom.
@ -88,6 +96,7 @@ class WelcomePage extends AbstractWelcomePage {
this._onRoomChange = this._onRoomChange.bind(this);
this._setAdditionalContentRef
= this._setAdditionalContentRef.bind(this);
this._setRoomInputRef = this._setRoomInputRef.bind(this);
this._setAdditionalToolbarContentRef
= this._setAdditionalToolbarContentRef.bind(this);
this._onTabSelected = this._onTabSelected.bind(this);
@ -184,9 +193,10 @@ class WelcomePage extends AbstractWelcomePage {
className = 'enter-room-input'
id = 'enter_room_field'
onChange = { this._onRoomChange }
pattern = '^[a-zA-Z0-9=\?]+$'
pattern = { ROOM_NAME_VALIDATE_PATTERN_STR }
placeholder = { this.state.roomPlaceholder }
title = { t('welcomepage.onlyAsciiAllowed') }
ref = { this._setRoomInputRef }
title = { t('welcomepage.roomNameAllowedChars') }
type = 'text'
value = { this.state.room } />
</form>
@ -194,7 +204,7 @@ class WelcomePage extends AbstractWelcomePage {
<div
className = 'welcome-page-button'
id = 'enter_room_button'
onClick = { this._onJoin }>
onClick = { this._onFormSubmit }>
{ t('welcomepage.go') }
</div>
</div>
@ -219,7 +229,9 @@ class WelcomePage extends AbstractWelcomePage {
_onFormSubmit(event) {
event.preventDefault();
this._onJoin();
if (!this._roomInputRef || this._roomInputRef.reportValidity()) {
this._onJoin();
}
}
/**
@ -311,6 +323,18 @@ class WelcomePage extends AbstractWelcomePage {
this._additionalToolbarContentRef = el;
}
/**
* Sets the internal reference to the HTMLInputElement used to hold the
* welcome page input room element.
*
* @param {HTMLInputElement} el - The HTMLElement for the input of the room name on the welcome page.
* @private
* @returns {void}
*/
_setRoomInputRef(el) {
this._roomInputRef = el;
}
/**
* Returns whether or not additional content should be displayed below
* the welcome page's header for entering a room name.