support login with keys flag and fix format of account data sent to browser

This commit is contained in:
Zachary Carter 2014-01-14 13:08:24 -08:00
Родитель 2c48b44e8f
Коммит 91efb8dfca
5 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -19,16 +19,16 @@ function (FxaClient, Constants) {
FxaClientWrapper.prototype = {
signIn: function (email, password) {
return this.client.signIn(email, password);
return this.client.signIn(email, password, { keys: true });
},
signUp: function (email, password) {
return this.client
.signUp(email, password)
.then(function () {
// when a user signs up, sign them in immediately
return this.signIn(email, password);
}.bind(this));
// when a user signs up, sign them in immediately
return this.signIn(email, password, { keys: true });
}.bind(this));
},
verifyCode: function (uid, code) {

Просмотреть файл

@ -28,7 +28,10 @@ function (BaseView, ConfirmTemplate, Session) {
setTimeout(function() {
Session.channel.send('login', {
email: Session.email,
token: Session.sessionToken,
uid: Session.uid,
isVerified: Session.verified,
verified: Session.verified,
sessionToken: Session.sessionToken,
unwrapBKey: Session.unwrapBKey,
keyFetchToken: Session.keyFetchToken
});

Просмотреть файл

@ -33,11 +33,13 @@ function (BaseView, CreateAccountTemplate, Session, FxaClient) {
_createAccount: function (email, password) {
var client = new FxaClient();
client.signUp(email, password)
.done(function () {
.done(function (accountData) {
// This info will be sent to the channel in the confirm screen.
Session.sessionToken = client.sessionToken;
Session.keyFetchToken = client.keyFetchToken;
Session.unwrapBKey = client.unwrapBKey;
Session.sessionToken = accountData.sessionToken;
Session.keyFetchToken = accountData.keyFetchToken;
Session.unwrapBKey = accountData.unwrapBKey;
Session.uid = accountData.uid;
Session.verified = accountData.verified;
router.navigate('confirm', { trigger: true });
},

Просмотреть файл

@ -31,13 +31,15 @@ function (BaseView, SignInTemplate, Session, FxaClient) {
var client = new FxaClient();
client.signIn(email, password)
.then(function (client) {
.then(function (accountData) {
Session.channel.send('login', {
email: email,
token: client.sessionToken,
unwrapBKey: client.unwrapBKey,
keyFetchToken: client.keyFetchToken
uid: accountData.uid,
isVerified: accountData.verified,
verified: accountData.verified,
sessionToken: accountData.sessionToken,
unwrapBKey: accountData.unwrapBKey,
keyFetchToken: accountData.keyFetchToken
});
router.navigate('settings', { trigger: true });
})

Просмотреть файл

@ -7,7 +7,7 @@
"underscore": "~1.5.2",
"backbone": "~1.1.0",
"modernizr": "~2.6.2",
"fxa-js-client": "https://github.com/mozilla/fxa-js-client.git#0.1.1",
"fxa-js-client": "https://github.com/mozilla/fxa-js-client.git#0.1.4",
"normalize-css": "~2.1.3",
"jquery.transit": "~0.9.9",
"requirejs-mustache": "*",