diff --git a/client/FxAccountClient.js b/client/FxAccountClient.js index 15967f6..05bd53d 100644 --- a/client/FxAccountClient.js +++ b/client/FxAccountClient.js @@ -47,6 +47,7 @@ define([ * @method signUp * @param {String} email Email input * @param {String} password Password input + * @param {String} name Name input * @param {Object} [options={}] Options * @param {String} [options.service] * Opaque alphanumeric token to be included in verification links @@ -64,19 +65,21 @@ define([ * set the language for the 'Accept-Language' header * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request */ - FxAccountClient.prototype.signUp = function (email, password, options) { + FxAccountClient.prototype.signUp = function (email, password, name, options) { var self = this; required(email, 'email'); required(password, 'password'); + required(name, 'name'); - return credentials.setup(email, password) + return credentials.setup(email, password, name) .then( function (result) { var endpoint = '/account/create'; var data = { email: result.emailUTF8, - authPW: sjcl.codec.hex.fromBits(result.authPW) + authPW: sjcl.codec.hex.fromBits(result.authPW), + name: result.name }; var requestOpts = {}; diff --git a/client/lib/credentials.js b/client/lib/credentials.js index 2590462..f82b9bc 100644 --- a/client/lib/credentials.js +++ b/client/lib/credentials.js @@ -50,13 +50,14 @@ define(['./request', 'sjcl', 'p', './hkdf', './pbkdf2'], function (Request, sjcl * @param {String} passwordInput * @return {Promise} A promise that will be fulfilled with `result` of generated credentials */ - setup: function (emailInput, passwordInput) { + setup: function (emailInput, passwordInput, nameInput) { var result = {}; var email = kwe('quickStretch', emailInput); var password = sjcl.codec.utf8String.toBits(passwordInput); result.emailUTF8 = emailInput; result.passwordUTF8 = passwordInput; + result.nameUTF8 = nameInput; return pbkdf2.derive(password, email, PBKDF2_ROUNDS, STRETCHED_PASS_LENGTH_BYTES) .then(