Implements functionality that forces the user to enter display name.

This commit is contained in:
hristoterezov 2015-07-02 17:04:37 +03:00
parent 1e0bf42203
commit 47b6355d66
5 changed files with 109 additions and 21 deletions

View File

@ -32,6 +32,7 @@ var config = {
enableWelcomePage: true,
enableSimulcast: false, // blocks FF support
logStats: false, // Enable logging of PeerConnection stats via the focus
// requireDisplayName: true,//Forces the participants that doesn't have display name to enter it when they enter the room.
// startAudioMuted: 10, //every participant after the Nth will start audio muted
// startVideoMuted: 10, //every participant after the Nth will start video muted
// defaultLanguage: "en",

View File

@ -13,7 +13,7 @@
<script src="libs/jquery-2.1.1.min.js"></script>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/1.5.0/sha.js"></script>
<script src="config.js?v=10"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
<script src="config.js?v=11"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
<script src="libs/strophe/strophe.min.js?v=1"></script>
<script src="libs/strophe/strophe.disco.min.js?v=1"></script>
<script src="libs/strophe/strophe.caps.jsonly.min.js?v=1"></script>
@ -22,7 +22,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=94"></script>
<script src="libs/app.bundle.js?v=95"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -194,7 +194,8 @@
"reservationErrorMsg": "Error code: __code__, message: __msg__",
"password": "password",
"userPassword": "user password",
"token": "token"
"token": "token",
"displayNameRequired": "Please enter your display name:"
},
"email":
{

View File

@ -1552,6 +1552,51 @@ var eventEmitter = new EventEmitter();
var roomName = null;
function promptDisplayName() {
var message = '<h2 data-i18n="dialog.displayNameRequired">';
message += APP.translation.translateString(
"dialog.displayNameRequired");
message += '</h2>' +
'<input name="displayName" type="text" data-i18n=' +
'"[placeholder]defaultNickname" placeholder="' +
APP.translation.translateString(
"defaultNickname", {name: "Jane Pink"}) +
'" autofocus>';
var buttonTxt
= APP.translation.generateTranslatonHTML("dialog.Ok");
var buttons = [];
buttons.push({title: buttonTxt, value: "ok"});
messageHandler.openDialog(null, message,
true,
buttons,
function (e, v, m, f) {
if (v == "ok") {
var displayName = f.displayName;
if (displayName) {
VideoLayout.inputDisplayNameHandler(displayName);
return true;
}
}
e.preventDefault();
},
function () {
var form = $.prompt.getPrompt();
var input = form.find("input[name='displayName']");
var button = form.find("button");
button.attr("disabled", "disabled");
input.keyup(function () {
if(!input.val())
button.attr("disabled", "disabled");
else
button.removeAttr("disabled");
});
}
);
}
function notifyForInitialMute()
{
messageHandler.notify(null, "notify.mutedTitle", "connected",
@ -1882,17 +1927,15 @@ UI.start = function (init) {
document.getElementById('largeVideo').volume = 0;
if (!$('#settings').is(':visible')) {
console.log('init');
init();
} else {
loginInfo.onsubmit = function (e) {
if (e.preventDefault) e.preventDefault();
$('#settings').hide();
init();
};
if(config.requireDisplayName) {
var currentSettings = Settings.getSettings();
if (!currentSettings.displayName) {
promptDisplayName();
}
}
init();
toastr.options = {
"closeButton": true,
"debug": false,

View File

@ -32,6 +32,51 @@ var eventEmitter = new EventEmitter();
var roomName = null;
function promptDisplayName() {
var message = '<h2 data-i18n="dialog.displayNameRequired">';
message += APP.translation.translateString(
"dialog.displayNameRequired");
message += '</h2>' +
'<input name="displayName" type="text" data-i18n=' +
'"[placeholder]defaultNickname" placeholder="' +
APP.translation.translateString(
"defaultNickname", {name: "Jane Pink"}) +
'" autofocus>';
var buttonTxt
= APP.translation.generateTranslatonHTML("dialog.Ok");
var buttons = [];
buttons.push({title: buttonTxt, value: "ok"});
messageHandler.openDialog(null, message,
true,
buttons,
function (e, v, m, f) {
if (v == "ok") {
var displayName = f.displayName;
if (displayName) {
VideoLayout.inputDisplayNameHandler(displayName);
return true;
}
}
e.preventDefault();
},
function () {
var form = $.prompt.getPrompt();
var input = form.find("input[name='displayName']");
var button = form.find("button");
button.attr("disabled", "disabled");
input.keyup(function () {
if(!input.val())
button.attr("disabled", "disabled");
else
button.removeAttr("disabled");
});
}
);
}
function notifyForInitialMute()
{
messageHandler.notify(null, "notify.mutedTitle", "connected",
@ -362,17 +407,15 @@ UI.start = function (init) {
document.getElementById('largeVideo').volume = 0;
if (!$('#settings').is(':visible')) {
console.log('init');
init();
} else {
loginInfo.onsubmit = function (e) {
if (e.preventDefault) e.preventDefault();
$('#settings').hide();
init();
};
if(config.requireDisplayName) {
var currentSettings = Settings.getSettings();
if (!currentSettings.displayName) {
promptDisplayName();
}
}
init();
toastr.options = {
"closeButton": true,
"debug": false,