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

This commit is contained in:
Yann Flory
2016-10-21 15:17:15 +02:00
parent 5d9b81ab2f
commit 1e003b13a8
6 changed files with 26 additions and 17 deletions

View File

@@ -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();
});