зеркало из https://github.com/mozilla/gecko-dev.git
use nsIUserInfo (if it exists, it doesn't on mac and windows yet) to pre-populate the users email address and full name.
This commit is contained in:
Родитель
fc97b0207e
Коммит
8719055576
|
@ -86,7 +86,8 @@ function validateEmail() {
|
|||
function onInit()
|
||||
{
|
||||
checkForDomain();
|
||||
|
||||
checkForFullName();
|
||||
checkForEmail();
|
||||
}
|
||||
|
||||
// retrieve the current domain from the parent wizard window,
|
||||
|
@ -110,3 +111,29 @@ function checkForDomain()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
function checkForFullName() {
|
||||
var name = document.getElementById("fullName");
|
||||
if (name.value=="") {
|
||||
try {
|
||||
var userInfo = Components.classes["component://netscape/userinfo"].getService(Components.interfaces.nsIUserInfo);
|
||||
name.value = userInfo.fullname;
|
||||
}
|
||||
catch (ex) {
|
||||
// dump ("checkForFullName failed: " + ex + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkForEmail() {
|
||||
var email = document.getElementById("email");
|
||||
if (email.value=="") {
|
||||
try {
|
||||
var userInfo = Components.classes["component://netscape/userinfo"].getService(Components.interfaces.nsIUserInfo);
|
||||
email.value = userInfo.emailAddress;
|
||||
}
|
||||
catch (ex) {
|
||||
// dump ("checkForEmail failed: " + ex + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче