Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Built fxa-js-client from commit 5f21ea3 on branch master
Browse files Browse the repository at this point in the history
  • Loading branch information
vladikoff committed Nov 24, 2015
1 parent b216d6e commit 3504597
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
50 changes: 50 additions & 0 deletions fxa-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,11 @@ define('client/FxAccountClient',[
* example.
* @param {String} [options.lang]
* set the language for the 'Accept-Language' header
* @param {Object} [options.device={}] Device registration information
* @param {String} name Name of device
* @param {String} type Type of device (mobile|desktop)
* @param {string} [callback] Device's push endpoint.
* @param {string} [publicKey] Public key used to encrypt push messages.
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.signUp = function (email, password, options) {
Expand All @@ -1989,6 +1994,21 @@ define('client/FxAccountClient',[
var requestOpts = {};

if (options) {
if (options.device) {
data.device = {
name: options.device.name,
type: options.device.type
};

if (options.device.callback) {
data.device.pushCallback = options.device.callback;
}

if (options.device.publicKey) {
data.device.pushPublicKey = options.device.publicKey;
}
}

if (options.service) {
data.service = options.service;
}
Expand Down Expand Up @@ -2052,6 +2072,12 @@ define('client/FxAccountClient',[
* @param {String} [options.reason]
* Reason for sign in. Can be one of: `signin`, `password_check`,
* `password_change`, `password_reset`, `account_unlock`.
* @param {Object} [options.device={}] Device registration information
* @param {String} [id] User-unique identifier of device
* @param {String} [name] Name of device
* @param {String} [type] Type of device (mobile|desktop)
* @param {string} [callback] Device's push endpoint.
* @param {string} [publicKey] Public key used to encrypt push messages.
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.signIn = function (email, password, options) {
Expand All @@ -2075,6 +2101,30 @@ define('client/FxAccountClient',[
authPW: sjcl.codec.hex.fromBits(result.authPW)
};

if (options.device) {
data.device = {};

if (options.device.id) {
data.device.id = options.device.id;
}

if (options.device.name) {
data.device.name = options.device.name;
}

if (options.device.type) {
data.device.type = options.device.type;
}

if (options.device.callback) {
data.device.pushCallback = options.device.callback;
}

if (options.device.publicKey) {
data.device.pushPublicKey = options.device.publicKey;
}
}

if (options.service) {
data.service = options.service;
}
Expand Down
Loading

0 comments on commit 3504597

Please sign in to comment.