ask anonymous, first-time users to set their name when they first join a pad

pull/1/head
Yann Flory 8 years ago
parent 5d9b81ab2f
commit 1e003b13a8

@ -45,6 +45,7 @@ define(function () {
out.userButton = 'UTILISATEUR';
out.userButtonTitle = "Changer votre nom d'utilisateur";
out.changeNamePrompt = 'Changer votre nom (laisser vide pour rester anonyme) : ';
out.renameButton = 'RENOMMER';
out.renameButtonTitle = 'Changer le titre utilisé par ce document dans la page d\'accueil de Cryptpad';

@ -45,7 +45,7 @@ define(function () {
out.userButton = 'USER';
out.userButtonTitle = 'Change your username';
out.changeNamePrompt = 'Change your name: ';
out.changeNamePrompt = 'Change your name (leave empty to be anonymous): ';
out.renameButton = 'RENAME';
out.renameButtonTitle = 'Change the title under which this document is listed on your home page';

@ -198,6 +198,7 @@ define([
console.error(err);
return;
}
module.userName.lastName = myUserName;
onLocal();
});
};
@ -321,12 +322,12 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// Store the object sent for the "change username" button so that we can update the field value correctly
var userNameButtonObject = module.userName = {};
/* add a "change username" button */
getLastName(function (err, lastName) {
var usernameCb = function (newName) {
setName (newName);
};
var $username = Cryptpad.createButton('username', false, {lastName: lastName}, usernameCb);
userNameButtonObject.lastName = lastName;
var $username = module.$userNameButton = Cryptpad.createButton('username', false, userNameButtonObject, setName);
$userBlock.append($username).hide();
});
@ -555,6 +556,8 @@ define([
addToUserList(myData);
if (typeof(lastName) === 'string' && lastName.length) {
setName(lastName);
} else {
module.$userNameButton.click();
}
onLocal();
});

@ -719,9 +719,8 @@ define([
title: Messages.userButton + '\n' + Messages.userButtonTitle
}).html('<span class="fa fa-user" style="font-family:FontAwesome;"></span>');
if (data && typeof data.lastName !== "undefined" && callback) {
var lastName = data.lastName;
button.click(function() {
common.prompt(Messages.changeNamePrompt, lastName, function (newName) {
common.prompt(Messages.changeNamePrompt, data.lastName, function (newName) {
callback(newName);
});
});

@ -291,12 +291,13 @@ define([
name: myUserName
};
addToUserList(myData);
editor.fire('change');
Cryptpad.setAttribute('username', newName, function (err, data) {
if (err) {
console.error("Couldn't set username");
return;
}
module.userName.lastName = myUserName;
editor.fire('change');
});
};
@ -535,12 +536,12 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// Store the object sent for the "change username" button so that we can update the field value correctly
var userNameButtonObject = module.userName = {};
/* add a "change username" button */
getLastName(function (err, lastName) {
var usernameCb = function (newName) {
setName (newName);
};
var $username = Cryptpad.createButton('username', false, {lastName: lastName}, usernameCb);
userNameButtonObject.lastName = lastName;
var $username = module.$userNameButton = Cryptpad.createButton('username', false, userNameButtonObject, setName);
$userBlock.append($username).hide();
});
@ -638,6 +639,8 @@ define([
addToUserList(myData);
if (typeof(lastName) === 'string' && lastName.length) {
setName(lastName);
} else {
module.$userNameButton.click();
}
realtimeOptions.onLocal();
});

@ -246,6 +246,7 @@ define([
console.error(err);
return;
}
module.userName.lastName = myUserName;
onLocal();
});
};
@ -398,12 +399,12 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// Store the object sent for the "change username" button so that we can update the field value correctly
var userNameButtonObject = module.userName = {};
/* add a "change username" button */
getLastName(function (err, lastName) {
var usernameCb = function (newName) {
setName (newName);
};
var $username = Cryptpad.createButton('username', false, {lastName: lastName}, usernameCb);
userNameButtonObject.lastName = lastName;
var $username = module.$userNameButton = Cryptpad.createButton('username', false, userNameButtonObject, setName);
$userBlock.append($username).hide();
});
@ -655,6 +656,8 @@ define([
addToUserList(myData);
if (typeof(lastName) === 'string' && lastName.length) {
setName(lastName);
} else {
module.$userNameButton.click();
}
onLocal();
});

Loading…
Cancel
Save