зеркало из https://github.com/mozilla/pjs.git
bug 433936 r=jay Fix QAC login process
This commit is contained in:
Родитель
f146258332
Коммит
930ebc17e6
|
@ -176,7 +176,7 @@ var CC_loginManager = Components.classes["@mozilla.org/login-manager;1"];
|
||||||
|
|
||||||
// The LoginManager does not like "null" for username/password fields,
|
// The LoginManager does not like "null" for username/password fields,
|
||||||
// So we send in the field names from the XUL.
|
// So we send in the field names from the XUL.
|
||||||
var newLogin = new nsLoginInfo('chrome://qa', 'Litmus Login', litmus.baseURL,
|
var newLogin = new nsLoginInfo('chrome://qa', null, litmus.baseURL,
|
||||||
username, password, "username", "password");
|
username, password, "username", "password");
|
||||||
try {
|
try {
|
||||||
this.manager().addLogin(newLogin);
|
this.manager().addLogin(newLogin);
|
||||||
|
@ -187,7 +187,7 @@ var CC_loginManager = Components.classes["@mozilla.org/login-manager;1"];
|
||||||
getPasswordObj: function() {
|
getPasswordObj: function() {
|
||||||
try {
|
try {
|
||||||
var logins = this.manager().findLogins({}, 'chrome://qa',
|
var logins = this.manager().findLogins({}, 'chrome://qa',
|
||||||
'Litmus Login', litmus.baseURL);
|
null, litmus.baseURL);
|
||||||
if (logins.length > 0 && logins[0] != null)
|
if (logins.length > 0 && logins[0] != null)
|
||||||
return logins[0];
|
return logins[0];
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -47,6 +47,11 @@ var qaMain = {
|
||||||
window.open("chrome://qa/content/setup.xul", "_blank",
|
window.open("chrome://qa/content/setup.xul", "_blank",
|
||||||
"chrome,all,dialog=yes");
|
"chrome,all,dialog=yes");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// We need to log the user into litmus
|
||||||
|
var storedLogin = qaPref.litmus.getPasswordObj();
|
||||||
|
this.correctCredentials(storedLogin.username, storedLogin.password, false);
|
||||||
|
}
|
||||||
if (qaPref.getPref(qaPref.prefBase + '.currentTestcase.testrunSummary', 'char') != null) {
|
if (qaPref.getPref(qaPref.prefBase + '.currentTestcase.testrunSummary', 'char') != null) {
|
||||||
litmus.readStateFromPref();
|
litmus.readStateFromPref();
|
||||||
}
|
}
|
||||||
|
@ -68,6 +73,45 @@ var qaMain = {
|
||||||
}
|
}
|
||||||
|
|
||||||
qaPrefsWindow.lastSelectedTab = newSelection;
|
qaPrefsWindow.lastSelectedTab = newSelection;
|
||||||
|
},
|
||||||
|
|
||||||
|
correctCredentials : function(username, password,isSecondTry) {
|
||||||
|
var callback = function (resp) {
|
||||||
|
if (resp.responseText == 0) {
|
||||||
|
qaMain.doLogin(isSecondTry);
|
||||||
|
} else {
|
||||||
|
// Then we need to store our validated creds
|
||||||
|
qaPref.litmus.setPassword(username, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// First we validate our stored login.
|
||||||
|
litmus.validateLogin(username, password, callback);
|
||||||
|
},
|
||||||
|
|
||||||
|
doLogin : function(isSecondTry) {
|
||||||
|
try {
|
||||||
|
var username = {value: "username"};
|
||||||
|
var password = {value: "password"};
|
||||||
|
var check = {value: "null"};
|
||||||
|
var title = qaMain.bundle.getString("qa.getpassword.title");
|
||||||
|
var msg = "";
|
||||||
|
|
||||||
|
if (!isSecondTry)
|
||||||
|
msg = qaMain.bundle.getString("qa.getpassword.message");
|
||||||
|
else
|
||||||
|
msg = qaMain.bundle.getString("qa.getpassword.tryagainmessage");
|
||||||
|
|
||||||
|
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPromptService);
|
||||||
|
var result = prompts.promptUsernameAndPassword(null, title, msg, username,
|
||||||
|
password, null, check);
|
||||||
|
|
||||||
|
this.correctCredentials(username.value, password.value, true);
|
||||||
|
} catch(ex) {
|
||||||
|
alert("ERROR LOGGING IN: " + ex);
|
||||||
|
dump("Error logging in: " + ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,3 +43,6 @@ qa.extension.sysconfig.loadingMsg = Loading menu options...
|
||||||
qa.extension.loading = Loading...
|
qa.extension.loading = Loading...
|
||||||
qa.extension.litmus.progress = Now Testing %1$S of %2$S
|
qa.extension.litmus.progress = Now Testing %1$S of %2$S
|
||||||
qa.extension.litmus.stats = Tests Completed - Week: %1$S, Month: %2$S, All Time: %3$S
|
qa.extension.litmus.stats = Tests Completed - Week: %1$S, Month: %2$S, All Time: %3$S
|
||||||
|
qa.getpassword.title = Login to Litmus
|
||||||
|
qa.getpassword.message = Enter the login information for your Litmus Account
|
||||||
|
qa.getpassword.tryagainmessage = Incorrect login information. Please enter the email address and password for your Litmus Account, if you have forgotten it, ask on IRC in #qa to have it reset.
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
<RDF:Description RDF:about="rdf:#$QJqvE"
|
<RDF:Description RDF:about="rdf:#$QJqvE"
|
||||||
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||||
em:minVersion="2.0"
|
em:minVersion="2.0"
|
||||||
em:maxVersion="3.0"/>
|
em:maxVersion="3.0.*"/>
|
||||||
<RDF:Description RDF:about="urn:mozilla:install-manifest"
|
<RDF:Description RDF:about="urn:mozilla:install-manifest"
|
||||||
em:id="{667e9f3d-0096-4d2b-b171-9a96afbabe20}"
|
em:id="{667e9f3d-0096-4d2b-b171-9a96afbabe20}"
|
||||||
em:version="0.1.12"
|
em:version="0.1.14"
|
||||||
em:type="2"
|
em:type="2"
|
||||||
em:name="Mozilla QA Companion"
|
em:name="Mozilla QA Companion"
|
||||||
em:description="The QA tool for testers."
|
em:description="The QA tool for testers."
|
||||||
|
|
Загрузка…
Ссылка в новой задаче