Bug 958546 - s/isVerified/verified in all FxAccounts related code. r=markh

This commit is contained in:
Fernando Jiménez 2014-01-14 17:00:36 +01:00
parent 471c9e9aa9
commit 9158242d47
5 changed files with 21 additions and 21 deletions

View File

@ -26,7 +26,7 @@ let tests = [
sessionToken: "dead",
kA: "beef",
kB: "cafe",
isVerified: true
verified: true
},
payloadType: "message",
validateResponse: function(payload) {

View File

@ -130,7 +130,7 @@ InternalMethods.prototype = {
* sessionToken: Session for the FxA server
* kA: An encryption key from the FxA server
* kB: An encryption key derived from the user's FxA password
* isVerified: email verification status
* verified: email verification status
* }
* or null if no user is signed in
*/
@ -305,7 +305,7 @@ InternalMethods.prototype = {
},
isUserEmailVerified: function isUserEmailVerified(data) {
return !!(data && data.isVerified);
return !!(data && data.verified);
},
/**
@ -334,7 +334,7 @@ InternalMethods.prototype = {
},
whenVerified: function(data) {
if (data.isVerified) {
if (data.verified) {
log.debug("already verified");
return Promise.resolve(data);
}
@ -388,7 +388,7 @@ InternalMethods.prototype = {
// off or stop polling altogether
this.getUserAccountData()
.then((data) => {
data.isVerified = true;
data.verified = true;
return this.setUserAccountData(data);
})
.then((data) => {
@ -456,7 +456,7 @@ this.FxAccounts.prototype = Object.freeze({
// set() makes sure that polling is happening, if necessary.
// get() does not wait for verification, and returns an object even if
// unverified. The caller of get() must check .isVerified .
// unverified. The caller of get() must check .verified .
// The "fxaccounts:onlogin" event will fire only when the verified state
// goes from false to true, so callers must register their observer
// and then call get(). In particular, it will not fire when the account
@ -464,7 +464,7 @@ this.FxAccounts.prototype = Object.freeze({
// the account is verified, the event will never fire. So callers must do:
// register notification observer (go)
// userdata = get()
// if (userdata.isVerified()) {go()}
// if (userdata.verified()) {go()}
/**
* Set the current user signed in to Firefox Accounts.
@ -477,7 +477,7 @@ this.FxAccounts.prototype = Object.freeze({
* uid: The user's unique id
* sessionToken: Session for the FxA server
* keyFetchToken: an unused keyFetchToken
* isVerified: true/false
* verified: true/false
* }
* @return Promise
* The promise resolves to null when the data is saved
@ -512,7 +512,7 @@ this.FxAccounts.prototype = Object.freeze({
* sessionToken: Session for the FxA server
* kA: An encryption key from the FxA server
* kB: An encryption key derived from the user's FxA password
* isVerified: email verification status
* verified: email verification status
* }
* or null if no user is signed in.
*/

View File

@ -88,7 +88,7 @@ this.FxAccountsClient.prototype = {
* {
* uid: the user's unique ID
* sessionToken: a session token
* isVerified: flag indicating verification status of the email
* verified: flag indicating verification status of the email
* }
*/
signIn: function signIn(email, password) {

View File

@ -138,7 +138,7 @@ add_task(function test_get_signed_in_user_initially_unset() {
sessionToken: "dead",
kA: "beef",
kB: "cafe",
isVerified: true
verified: true
};
let result = yield account.getSignedInUser();
@ -203,7 +203,7 @@ add_test(function test_verification_poll() {
// Once email verification is complete, we will observe onlogin
fxa.internal.getUserAccountData().then(user => {
// And confirm that the user's state has changed
do_check_eq(user.isVerified, true);
do_check_eq(user.verified, true);
do_check_eq(user.email, test_user.email);
do_test_finished();
run_next_test();
@ -213,7 +213,7 @@ add_test(function test_verification_poll() {
fxa.setSignedInUser(test_user).then(() => {
fxa.internal.getUserAccountData().then(user => {
// The user is signing in, but email has not been verified yet
do_check_eq(user.isVerified, false);
do_check_eq(user.verified, false);
do_timeout(200, function() {
// Mock email verification ...
fxa.internal.fxAccountsClient._email = test_user.email;
@ -268,7 +268,7 @@ add_test(function test_getKeys() {
let user = getTestUser("eusebius");
// Once email has been verified, we will be able to get keys
user.isVerified = true;
user.verified = true;
fxa.setSignedInUser(user).then(() => {
fxa.getSignedInUser().then((user) => {
@ -282,7 +282,7 @@ add_test(function test_getKeys() {
fxa.getSignedInUser().then((user) => {
// Now we should have keys
do_check_eq(fxa.internal.isUserEmailVerified(user), true);
do_check_eq(!!user.isVerified, true);
do_check_eq(!!user.verified, true);
do_check_eq(user.kA, expandHex("11"));
do_check_eq(user.kB, expandHex("66"));
do_check_eq(user.keyFetchToken, undefined);
@ -334,7 +334,7 @@ add_test(function test_overlapping_signins() {
// Once email verification is complete, we will observe onlogin
fxa.internal.getUserAccountData().then(user => {
do_check_eq(user.email, bob.email);
do_check_eq(user.isVerified, true);
do_check_eq(user.verified, true);
do_test_finished();
run_next_test();
});
@ -345,7 +345,7 @@ add_test(function test_overlapping_signins() {
log.debug("Alice signing in ...");
fxa.internal.getUserAccountData().then(user => {
do_check_eq(user.email, alice.email);
do_check_eq(user.isVerified, false);
do_check_eq(user.verified, false);
log.debug("Alice has not verified her email ...");
// Now Bob signs in instead and actually verifies his email
@ -372,9 +372,9 @@ add_task(function test_getAssertion() {
sessionToken: "sessionToken",
kA: expandHex("11"),
kB: expandHex("66"),
isVerified: true
verified: true
};
// By putting kA/kB/isVerified in "creds", we skip ahead
// By putting kA/kB/verified in "creds", we skip ahead
// to the "we're ready" stage.
yield fxa.setSignedInUser(creds);
@ -471,7 +471,7 @@ function getTestUser(name) {
sessionToken: name + "'s session token",
keyFetchToken: name + "'s keyfetch token",
unwrapBKey: expandHex("44"),
isVerified: false
verified: false
};
}

View File

@ -76,7 +76,7 @@ this.makeIdentityConfig = function(overrides) {
kB: 'kB',
sessionToken: 'sessionToken',
uid: 'user_uid',
isVerified: true,
verified: true,
},
token: {
endpoint: Svc.Prefs.get("tokenServerURI"),