auth0-lock 11.30.3 → 11.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DEVELOPMENT.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Requires:
4
4
 
5
5
  - [Yarn](https://yarnpkg.com/)
6
- - Node 10.x
6
+ - >= Node 10.18.1
7
7
 
8
8
  ## Building
9
9
 
@@ -20,13 +20,23 @@ yarn build
20
20
  Unit tests can be executed using [Jest](https://jestjs.io/) by issuing the following command:
21
21
 
22
22
  ```
23
- yarn test:jest
23
+ yarn test
24
24
  ```
25
25
 
26
26
  To interactively perform tests using Jest's `watch` mode, use:
27
27
 
28
28
  ```
29
- yarn test:jest:watch
29
+ yarn test:watch
30
+ ```
31
+
32
+ End-to-end tests can be executed locally using [Karma](https://karma-runner.github.io/), in both watch and CLI mode:
33
+
34
+ ```
35
+ # CLI mode using Chrome Headless browser:
36
+ yarn test:e2e
37
+
38
+ # Watch mode using Chrome desktop browser, in watch mode:
39
+ yarn test:e2e:watch
30
40
  ```
31
41
 
32
42
  ## The SDK Playground
package/LICENSE CHANGED
@@ -19,3 +19,26 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ ============================================================================
24
+
25
+ Copyright + license attribution for `format` function used in src/utils/format.js:
26
+
27
+ Copyright Joyent, Inc. and other Node contributors. All rights reserved.
28
+ Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ of this software and associated documentation files (the "Software"), to
30
+ deal in the Software without restriction, including without limitation the
31
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
32
+ sell copies of the Software, and to permit persons to whom the Software is
33
+ furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be included in
36
+ all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
44
+ IN THE SOFTWARE.
package/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
  [Auth0](https://auth0.com) is an authentication broker that supports both social and enterprise identity providers, including Active Directory, LDAP, Google Apps, and Salesforce.
11
11
 
12
12
  ## Table of Contents
13
+
13
14
  1. [Install](#install)
14
15
  2. [Cross Origin Authentication](#cross-origin-authentication)
15
16
  3. [API](#api)
@@ -24,7 +25,7 @@ From CDN
24
25
 
25
26
  ```html
26
27
  <!-- Latest patch release (recommended for production) -->
27
- <script src="https://cdn.auth0.com/js/lock/11.30.3/lock.min.js"></script>
28
+ <script src="https://cdn.auth0.com/js/lock/11.31.0/lock.min.js"></script>
28
29
  ```
29
30
 
30
31
  From [npm](https://npmjs.org)
@@ -50,8 +51,9 @@ After installing the `auth0-lock` module, you'll need to bundle it up along with
50
51
  If you are targeting mobile audiences, we recommended that you add:
51
52
 
52
53
  ```html
53
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
54
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
54
55
  ```
56
+
55
57
  ## Cross-Origin Authentication
56
58
 
57
59
  Lock uses **Cross-Origin Authentication**, make sure you understand the considerations you need to take into account by reading the [Cross-Origin Authentication documentation](https://auth0.com/docs/cross-origin-authentication).
@@ -69,14 +71,14 @@ Initializes a new instance of `Auth0Lock` configured with your application `clie
69
71
  #### Example
70
72
 
71
73
  ```js
72
- var clientId = "YOUR_AUTH0_APP_CLIENTID";
73
- var domain = "YOUR_DOMAIN_AT.auth0.com";
74
+ var clientId = 'YOUR_AUTH0_APP_CLIENTID';
75
+ var domain = 'YOUR_DOMAIN_AT.auth0.com';
74
76
  var lock = new Auth0Lock(clientId, domain);
75
77
  var accessToken = null;
76
78
  var profile = null;
77
79
 
78
- lock.on("authenticated", function(authResult) {
79
- lock.getUserInfo(authResult.accessToken, function(error, profileResult) {
80
+ lock.on('authenticated', function (authResult) {
81
+ lock.getUserInfo(authResult.accessToken, function (error, profileResult) {
80
82
  if (error) {
81
83
  // Handle error
82
84
  return;
@@ -107,14 +109,14 @@ For more information, read our [passwordless docs](https://auth0.com/docs/connec
107
109
  #### Example
108
110
 
109
111
  ```js
110
- var clientId = "YOUR_AUTH0_APP_CLIENTID";
111
- var domain = "YOUR_DOMAIN_AT.auth0.com";
112
+ var clientId = 'YOUR_AUTH0_APP_CLIENTID';
113
+ var domain = 'YOUR_DOMAIN_AT.auth0.com';
112
114
  var lock = new Auth0LockPasswordless(clientId, domain);
113
115
  var accessToken = null;
114
116
  var profile = null;
115
117
 
116
- lock.on("authenticated", function(authResult) {
117
- lock.getUserInfo(authResult.accessToken, function(error, profileResult) {
118
+ lock.on('authenticated', function (authResult) {
119
+ lock.getUserInfo(authResult.accessToken, function (error, profileResult) {
118
120
  if (error) {
119
121
  // Handle error
120
122
  return;
@@ -138,9 +140,9 @@ Once the user has logged in and you are in possession of an access token, you ca
138
140
  #### Example
139
141
 
140
142
  ```js
141
- lock.getUserInfo(accessToken, function(error, profile) {
143
+ lock.getUserInfo(accessToken, function (error, profile) {
142
144
  if (!error) {
143
- alert("hello " + profile.name);
145
+ alert('hello ' + profile.name);
144
146
  }
145
147
  });
146
148
  ```
@@ -178,24 +180,25 @@ Displays the widget, allowing you to override some options.
178
180
  lock.show();
179
181
 
180
182
  // will override the allowedConnections option passed to the constructor, if any
181
- lock.show({allowedConnections: ["twitter", "facebook"]})
183
+ lock.show({ allowedConnections: ['twitter', 'facebook'] });
182
184
 
183
185
  // will override the entire auth.params object passed to the constructor, if any
184
- lock.show({auth: {params: {state: 'auth_state'}}})
186
+ lock.show({ auth: { params: { state: 'auth_state' } } });
185
187
  ```
186
188
 
187
189
  ### resumeAuth(hash, callback)
188
190
 
189
191
  If you set the [auth.autoParseHash](#authentication-options) option to `false`, you'll need to call this method to complete the authentication flow. This method is useful when you're using a client-side router that uses a `#` to handle URLs (angular2 with `useHash` or react-router with `hashHistory`).
192
+
190
193
  - **hash {String}**: The hash fragment received from the redirect.
191
194
  - **callback {Function}**: Will be invoked after the parse is done. Has an error (if any) as the first argument and the authentication result as the second one. If there is no hash available, both arguments will be `null`.
192
195
 
193
196
  #### Example
194
197
 
195
198
  ```js
196
- lock.resumeAuth(hash, function(error, authResult) {
199
+ lock.resumeAuth(hash, function (error, authResult) {
197
200
  if (error) {
198
- alert("Could not parse hash");
201
+ alert('Could not parse hash');
199
202
  }
200
203
  console.log(authResult.accessToken);
201
204
  });
@@ -216,6 +219,7 @@ lock.logout({ returnTo: 'https://myapp.com/bye-bye' });
216
219
  ### checkSession(params, callback)
217
220
 
218
221
  The checkSession method allows you to acquire a new token from Auth0 for a user who is already authenticated against the universal login page for your domain. The method accepts any valid OAuth2 parameters that would normally be sent to authorize. In order to use this method, you have to enable Web Origins for your application. For more information, see [Using checkSession to acquire new tokens](https://auth0.com/docs/libraries/auth0js#using-checksession-to-acquire-new-tokens).
222
+
219
223
  - **params {Object}**: OAuth2 params object to send to Auth0's servers.
220
224
  - **callback {Function}**: Will be invoked after the response from the server is returned. Has an error (if any) as the first argument and the authentication result as the second one.
221
225
 
@@ -261,14 +265,14 @@ The appearance of the widget and the mechanics of authentication can be customiz
261
265
  - **popupOptions {Object}**: Allows you to customize the location of the popup in the screen. Any [position and size feature](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#Position_and_size_features) allowed by `window.open` is accepted. Defaults to `{}`.
262
266
  - **rememberLastLogin {Boolean}**: Determines whether or not to show a screen that allows you to quickly log in with the account you used the last time when the `initialScreen` option is set to `"login"` (the default). Defaults to `true`.
263
267
  - **flashMessage {Object}**: Shows an `error` or `success` flash message when Lock is shown.
264
- + **type {String}**: The message type, it should be `error` or `success`.
265
- + **text {String}**: The text to show.
268
+ - **type {String}**: The message type, it should be `error` or `success`.
269
+ - **text {String}**: The text to show.
266
270
  - **allowAutocomplete {Boolean}**: Determines whether or not the email or username inputs will allow autocomplete (`<input autocomplete />`). Defaults to `false`.
267
271
  - **scrollGlobalMessagesIntoView {Boolean}**: Determines whether or not a globalMessage should be scrolled into the user's viewport. Defaults to `true`.
268
272
  - **allowShowPassword {Boolean}**: Determines whether or not add a checkbox to show the password when typing it. Defaults to `false`.
269
273
  - **allowPasswordAutocomplete {Boolean}**: Determines whether the password field will allow autocomplete; setting this to `true` is required for password manager support and to avoid many cases of adverse behavior. Defaults to `false`.
270
274
  - **preferConnectionDisplayName {Boolean}**: If true, Lock will try to use the connection display name as configured in the manage dashboard, if available.
271
-
275
+ - **forceAutoHeight {Boolean}**: If true, Lock will use the `height: auto!important` style on the wrapping div, which may be useful in some circumstances where `height: 100vh` is undesirable (see [\#1963](https://github.com/auth0/lock/issues/1963)). Defaults to `false`.
272
276
 
273
277
  #### Theming options
274
278
 
@@ -278,14 +282,14 @@ Theme options are grouped in the `theme` property of the `options` object.
278
282
  var options = {
279
283
  theme: {
280
284
  labeledSubmitButton: false,
281
- logo: "https://example.com/assets/logo.png",
282
- primaryColor: "green",
285
+ logo: 'https://example.com/assets/logo.png',
286
+ primaryColor: 'green',
283
287
  authButtons: {
284
288
  connectionName: {
285
- displayName: "...",
286
- primaryColor: "...",
287
- foregroundColor: "...",
288
- icon: "https://.../logo.png"
289
+ displayName: '...',
290
+ primaryColor: '...',
291
+ foregroundColor: '...',
292
+ icon: 'https://.../logo.png'
289
293
  }
290
294
  }
291
295
  }
@@ -296,10 +300,10 @@ var options = {
296
300
  - **logo {String}**: Url for an image that will be placed in the Lock's header. Defaults to Auth0's logo.
297
301
  - **primaryColor {String}**: Defines the primary color of the Lock, all colors used in the widget will be calculated from it. This option is useful when providing a custom `logo` to ensure all colors go well together with the logo's color palette. Defaults to `"#ea5323"`.
298
302
  - **authButtons {Object}**: Allows the customization of the custom oauth2 login buttons.
299
- + **displayName {String}**: The name to show instead of the connection name.
300
- + **primaryColor {String}**: The button's background color. Defaults to `"#eb5424"`.
301
- + **foregroundColor {String}**: The button's text color. Defaults to `"#FFFFFF"`.
302
- + **icon {String}**: The icon's url for the connection. For example:`"https://site.com/logo.png"`.
303
+ - **displayName {String}**: The name to show instead of the connection name.
304
+ - **primaryColor {String}**: The button's background color. Defaults to `"#eb5424"`.
305
+ - **foregroundColor {String}**: The button's text color. Defaults to `"#FFFFFF"`.
306
+ - **icon {String}**: The icon's url for the connection. For example:`"https://site.com/logo.png"`.
303
307
 
304
308
  #### Authentication options
305
309
 
@@ -308,19 +312,19 @@ Authentication options are grouped in the `auth` property of the `options` objec
308
312
  ```js
309
313
  var options = {
310
314
  auth: {
311
- params: {
312
- param1: "value1",
313
- scope: "openid profile email"
314
- },
315
- autoParseHash: true,
316
- redirect: true,
317
- redirectUrl: "some url",
318
- responseMode: "form_post",
319
- responseType: "token",
320
- sso: true,
321
- connectionScopes: {
322
- connectionName: [ 'scope1', 'scope2' ]
323
- }
315
+ params: {
316
+ param1: 'value1',
317
+ scope: 'openid profile email'
318
+ },
319
+ autoParseHash: true,
320
+ redirect: true,
321
+ redirectUrl: 'some url',
322
+ responseMode: 'form_post',
323
+ responseType: 'token',
324
+ sso: true,
325
+ connectionScopes: {
326
+ connectionName: ['scope1', 'scope2']
327
+ }
324
328
  }
325
329
  };
326
330
  ```
@@ -329,10 +333,10 @@ var options = {
329
333
  - **autoParseHash {Boolean}**: When set to `true`, Lock will parse the `window.location.hash` string when instantiated. If set to `false`, you'll have to manually resume authentication using the [resumeAuth](#resumeauthhash-callback) method.
330
334
  - **redirect {Boolean}**: When set to `true`, the default, _redirect mode_ will be used. Otherwise, _popup mode_ is chosen. See [below](#popup-mode) for more details.
331
335
  - **redirectUrl {String}**: The URL Auth0 will redirect back to after authentication. Defaults to the empty string `""` (no redirect URL).
332
- - **responseMode {String}**: Should be set to `"form_post"` if you want the code or the token to be transmitted via an HTTP POST request to the `redirectUrl` instead of being included in its query or fragment parts. Otherwise, it should be omitted.
333
- - **responseType {String}**: Should be set to `"token"` for Single Page Applications, and `"code"` otherwise. Also, `"id_token"` is supported for the first case. Defaults to `"code"` when `redirectUrl` is provided, and to `"token"` otherwise.
334
- - **sso {Boolean}**: Determines whether Single Sign-On is enabled or not in **Lock**. The Auth0 SSO session will be created regardless of this option if SSO is enabled for your application or tenant.
335
- - **connectionScopes {Object}**: Allows you to set scopes to be sent to the oauth2/social/enterprise connection for authentication.
336
+ - **responseMode {String}**: Should be set to `"form_post"` if you want the code or the token to be transmitted via an HTTP POST request to the `redirectUrl` instead of being included in its query or fragment parts. Otherwise, it should be omitted.
337
+ - **responseType {String}**: Should be set to `"token"` for Single Page Applications, and `"code"` otherwise. Also, `"id_token"` is supported for the first case. Defaults to `"code"` when `redirectUrl` is provided, and to `"token"` otherwise.
338
+ - **sso {Boolean}**: Determines whether Single Sign-On is enabled or not in **Lock**. The Auth0 SSO session will be created regardless of this option if SSO is enabled for your application or tenant.
339
+ - **connectionScopes {Object}**: Allows you to set scopes to be sent to the oauth2/social/enterprise connection for authentication.
336
340
 
337
341
  #### Database options
338
342
 
@@ -341,7 +345,7 @@ var options = {
341
345
  - **allowForgotPassword {Boolean}**: When set to `false` hides the _"Don't remember your password?"_ link in the _login screen_, making the _forgot password screen_ unreachable. Defaults to `true`. Keep in mind that if you are using a database connection with a _custom database_ which doesn't have a _change password script_ the forgot password screen won't be available.
342
346
  - **allowSignUp {Boolean}**: When set to `false` hides the _login and sign up tabs_ in the _login screen_, making the _sign up screen_ unreachable. Defaults to `true`. Keep in mind that if the database connection has sign ups _disabled_ or you are using a _custom database_ which doesn't have a _create script_, then the sign up screen won't be available.
343
347
  - **defaultDatabaseConnection {String}**: Specifies the database connection that will be used when there is more than one available.
344
- - **initialScreen {String}**: Name of the screen that will be shown when the widget is opened. Valid values are `"login"`, `"signUp"`, and `"forgotPassword"`. If this option is left unspecified, the widget will pick the first screen that is available from the previous list. If you set `initialScreen` to `"forgotPassword"` we recommend that you set `allowLogin` to `"false"`, otherwise a back button will be shown in the forgot password screen and it might not be clear to the user where that back button will take them.
348
+ - **initialScreen {String}**: Name of the screen that will be shown when the widget is opened. Valid values are `"login"`, `"signUp"`, and `"forgotPassword"`. If this option is left unspecified, the widget will pick the first screen that is available from the previous list. If you set `initialScreen` to `"forgotPassword"` we recommend that you set `allowLogin` to `"false"`, otherwise a back button will be shown in the forgot password screen and it might not be clear to the user where that back button will take them.
345
349
  - **loginAfterSignUp {Boolean}**: Determines whether or not the user will be automatically signed in after a successful sign up. Defaults to `true`.
346
350
  - **forgotPasswordLink {String}**: URL for a page that allows the user to reset her password. When set to a non-empty string, the user will be linked to the provided URL when clicking the _"Don't remember your password?"_ link in the _login screen_.
347
351
  - **showTerms {Boolean}**: When set to `true` displays the `languageDictionary.signUpTerms` string. Defaults to `true`.
@@ -350,6 +354,7 @@ var options = {
350
354
  - **signUpLink {String}**: URL for a page that allows the user to sign up. When set to a non-empty string, the user will be linked to the provided URL when clicking the _sign up_ tab in the _login screen_.
351
355
  - **usernameStyle {String}**: Determines what will be used to identify the user for a Database connection that has the `requires_username` flag set, otherwise it will be ignored. Possible values are `"username"` and `"email"` and by default both `username` and `email` are allowed.
352
356
  - **signUpHideUsernameField {Boolean}**: When set to `true` hides the _username_ input during sign up for a Database connection that has the `requires_username` flag set. Defaults to `false`.
357
+ - **signUpFieldsStrictValidation {Boolean}**: When set to `true`, the _email_ input on the sign-up page is validated using [`validator`](https://www.npmjs.com/package/validator). Otherwise, a very loose check is made on the format before being fully validate on the server. Defaults to `false`.
353
358
 
354
359
  #### Enterprise options
355
360
 
@@ -359,11 +364,12 @@ var options = {
359
364
 
360
365
  ```js
361
366
  var options = {
362
- container: "myContainer",
367
+ container: 'myContainer',
363
368
  closable: false,
364
369
  languageDictionary: {
365
- signUpTerms: "I agree to the <a href='/terms' target='_new'>terms of service</a> and <a href='/privacy' target='_new'>privacy policy</a>.",
366
- title: "My Company",
370
+ signUpTerms:
371
+ "I agree to the <a href='/terms' target='_new'>terms of service</a> and <a href='/privacy' target='_new'>privacy policy</a>.",
372
+ title: 'My Company'
367
373
  },
368
374
  autofocus: false
369
375
  };
@@ -389,18 +395,18 @@ Users logging in using this connection should then be associated with the correc
389
395
 
390
396
  Lock supports hooks that can be used to integrate into various procedures within Lock.
391
397
 
392
- | Name | Description |
393
- |----|-----|
394
- | `loggingIn` | Called when the user presses the login button; after validating the login form, but before calling the login endpoint |
398
+ | Name | Description |
399
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
400
+ | `loggingIn` | Called when the user presses the login button; after validating the login form, but before calling the login endpoint |
395
401
  | `signingUp` | Called when the user presses the button on the sign-up page; after validating the signup form, but before calling the sign up endpoint |
396
402
 
397
403
  **API**
398
404
  Both hooks accept two arguments:
399
405
 
400
- | Name | Description |
401
- |----|----|
406
+ | Name | Description |
407
+ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
402
408
  | `context` | this argument is currently always `null` but serves as a future-proofing mechanism to support providing additional data without us requiring breaking changes to the library |
403
- | `cb` | a callback function to call when the hook is finished. Execution of the user journey is blocked until this function is called by the hook |
409
+ | `cb` | a callback function to call when the hook is finished. Execution of the user journey is blocked until this function is called by the hook |
404
410
 
405
411
  **API**
406
412
 
@@ -459,7 +465,7 @@ var options = {
459
465
  cb(null);
460
466
  }
461
467
  }
462
- }
468
+ };
463
469
  ```
464
470
 
465
471
  #### Language Dictionary Specification
@@ -469,9 +475,9 @@ A language dictionary is an object that allows you to customize every piece of t
469
475
  ```js
470
476
  var options = {
471
477
  languageDictionary: {
472
- emailInputPlaceholder: "Please enter your email",
473
- title: "My Company"
474
- },
478
+ emailInputPlaceholder: 'Please enter your email',
479
+ title: 'My Company'
480
+ }
475
481
  };
476
482
  ```
477
483
 
@@ -483,24 +489,26 @@ Additional sign up fields are rendered below the default fields in the order the
483
489
 
484
490
  ##### Text field
485
491
 
486
- A `validator` function can also be provided.
492
+ A `validator` function can also be provided.
487
493
 
488
494
  ```js
489
495
  var options = {
490
- additionalSignUpFields: [{
491
- name: "address",
492
- placeholder: "enter your address",
493
- // The following properties are optional
494
- ariaLabel: "Address",
495
- icon: "https://example.com/assets/address_icon.png",
496
- prefill: "street 123",
497
- validator: function(address) {
498
- return {
499
- valid: address.length >= 10,
500
- hint: "Must have 10 or more chars" // optional
501
- };
496
+ additionalSignUpFields: [
497
+ {
498
+ name: 'address',
499
+ placeholder: 'enter your address',
500
+ // The following properties are optional
501
+ ariaLabel: 'Address',
502
+ icon: 'https://example.com/assets/address_icon.png',
503
+ prefill: 'street 123',
504
+ validator: function (address) {
505
+ return {
506
+ valid: address.length >= 10,
507
+ hint: 'Must have 10 or more chars' // optional
508
+ };
509
+ }
502
510
  }
503
- }]
511
+ ]
504
512
  };
505
513
  ```
506
514
 
@@ -508,11 +516,15 @@ If you don't provide a `validator` function a default validator is applied, whic
508
516
 
509
517
  ```js
510
518
  var options = {
511
- additionalSignUpFields: [{
512
- name: "address",
513
- placeholder: "enter your address (optional)",
514
- validator: function() {return true;}
515
- }]
519
+ additionalSignUpFields: [
520
+ {
521
+ name: 'address',
522
+ placeholder: 'enter your address (optional)',
523
+ validator: function () {
524
+ return true;
525
+ }
526
+ }
527
+ ]
516
528
  };
517
529
  ```
518
530
 
@@ -520,10 +532,12 @@ If you want to save the value of the attribute in the root of your profile, use
520
532
 
521
533
  ```js
522
534
  var options = {
523
- additionalSignUpFields: [{
524
- name: "name",
525
- storage: "root"
526
- }]
535
+ additionalSignUpFields: [
536
+ {
537
+ name: 'name',
538
+ storage: 'root'
539
+ }
540
+ ]
527
541
  };
528
542
  ```
529
543
 
@@ -533,45 +547,49 @@ To specify a select field `type: "select"` needs to be provided along with the `
533
547
 
534
548
  ```js
535
549
  var options = {
536
- additionalSignUpFields: [{
537
- type: "select",
538
- name: "location",
539
- placeholder: "choose your location",
540
- options: [
541
- {value: "us", label: "United States"},
542
- {value: "fr", label: "France"},
543
- {value: "ar", label: "Argentina"}
544
- ],
545
- // The following properties are optional
546
- ariaLabel: "Location",
547
- icon: "https://example.com/assets/location_icon.png",
548
- prefill: "us"
549
- }]
550
- }
550
+ additionalSignUpFields: [
551
+ {
552
+ type: 'select',
553
+ name: 'location',
554
+ placeholder: 'choose your location',
555
+ options: [
556
+ { value: 'us', label: 'United States' },
557
+ { value: 'fr', label: 'France' },
558
+ { value: 'ar', label: 'Argentina' }
559
+ ],
560
+ // The following properties are optional
561
+ ariaLabel: 'Location',
562
+ icon: 'https://example.com/assets/location_icon.png',
563
+ prefill: 'us'
564
+ }
565
+ ]
566
+ };
551
567
  ```
552
568
 
553
569
  The `options` and the `prefill` value can be provided through a function.
554
570
 
555
571
  ```js
556
572
  var options = {
557
- additionalSignUpFields: [{
558
- type: "select",
559
- name: "location",
560
- placeholder: "choose your location",
561
- options: function(cb) {
562
- // obtain options, in case of error you call cb with the error in the
563
- // first arg instead of null
564
- cb(null, options);
565
- },
566
- ariaLabel: "Location",
567
- icon: "https://example.com/assets/location_icon.png",
568
- prefill: function(cb) {
569
- // obtain prefill, in case of error you call cb with the error in the
570
- // first arg instead of null
571
- cb(null, prefill);
573
+ additionalSignUpFields: [
574
+ {
575
+ type: 'select',
576
+ name: 'location',
577
+ placeholder: 'choose your location',
578
+ options: function (cb) {
579
+ // obtain options, in case of error you call cb with the error in the
580
+ // first arg instead of null
581
+ cb(null, options);
582
+ },
583
+ ariaLabel: 'Location',
584
+ icon: 'https://example.com/assets/location_icon.png',
585
+ prefill: function (cb) {
586
+ // obtain prefill, in case of error you call cb with the error in the
587
+ // first arg instead of null
588
+ cb(null, prefill);
589
+ }
572
590
  }
573
- }]
574
- }
591
+ ]
592
+ };
575
593
  ```
576
594
 
577
595
  ##### Checkbox field
@@ -581,18 +599,21 @@ The `prefill` value can determine the default state of the checkbox and it is re
581
599
 
582
600
  ```js
583
601
  var options = {
584
- additionalSignUpFields: [{
585
- type: "checkbox",
586
- name: "newsletter",
587
- prefill: "true",
588
- placeholder: "I hereby agree that I want to receive marketing emails from your company",
589
- // placeholderHTML - is an optional field and overrides the value of placeholder
590
- // do not use user inputted data for HTML fields as they are vulnerable to XSS
591
- placeholderHTML: "<b>I hereby agree that I want to receive marketing emails from your company</b>",
592
- // ariaLabel - is an optional field
593
- ariaLabel: "Activate Newsletter"
594
- }]
595
- }
602
+ additionalSignUpFields: [
603
+ {
604
+ type: 'checkbox',
605
+ name: 'newsletter',
606
+ prefill: 'true',
607
+ placeholder: 'I hereby agree that I want to receive marketing emails from your company',
608
+ // placeholderHTML - is an optional field and overrides the value of placeholder
609
+ // do not use user inputted data for HTML fields as they are vulnerable to XSS
610
+ placeholderHTML:
611
+ '<b>I hereby agree that I want to receive marketing emails from your company</b>',
612
+ // ariaLabel - is an optional field
613
+ ariaLabel: 'Activate Newsletter'
614
+ }
615
+ ]
616
+ };
596
617
  ```
597
618
 
598
619
  ##### Hidden field
@@ -601,12 +622,14 @@ To specify a hidden field use: `type: "hidden"`. Both the `value` and `name` pro
601
622
 
602
623
  ```js
603
624
  var options = {
604
- additionalSignUpFields: [{
605
- type: "hidden",
606
- name: "signup_code",
607
- value: "foobar123"
608
- }]
609
- }
625
+ additionalSignUpFields: [
626
+ {
627
+ type: 'hidden',
628
+ name: 'signup_code',
629
+ value: 'foobar123'
630
+ }
631
+ ]
632
+ };
610
633
  ```
611
634
 
612
635
  #### Avatar provider
@@ -616,12 +639,12 @@ Lock can show avatars fetched from anywhere. A custom avatar provider can be spe
616
639
  ```js
617
640
  var options = {
618
641
  avatar: {
619
- url: function(email, cb) {
642
+ url: function (email, cb) {
620
643
  // obtain URL for email, in case of error you call cb with the error in
621
644
  // the first arg instead of null
622
645
  cb(null, url);
623
646
  },
624
- displayName: function(email, cb) {
647
+ displayName: function (email, cb) {
625
648
  // obtain displayName for email, in case of error you call cb with the
626
649
  // error in the first arg instead of null
627
650
  cb(null, displayName);
@@ -637,8 +660,8 @@ A popup window can be displayed instead of redirecting the user to a social prov
637
660
  If you decide to use popup mode you can activate it by passing the option `auth: {redirect: false}` when constructing `Auth0Lock`.
638
661
 
639
662
  ```js
640
- var clientId = "YOUR_AUTH0_APP_CLIENTID";
641
- var domain = "YOUR_DOMAIN_AT.auth0.com";
663
+ var clientId = 'YOUR_AUTH0_APP_CLIENTID';
664
+ var domain = 'YOUR_DOMAIN_AT.auth0.com';
642
665
  var options = {
643
666
  auth: {
644
667
  redirect: false
@@ -667,7 +690,6 @@ If you have found a bug or if you have a feature request, please report them at
667
690
 
668
691
  This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
669
692
 
670
-
671
693
  [circleci-image]: https://img.shields.io/circleci/project/github/auth0/lock.svg?style=flat-square
672
694
  [circleci-url]: https://circleci.com/gh/auth0/lock/tree/master
673
695
  [npm-image]: https://img.shields.io/npm/v/auth0-lock.svg?style=flat-square
@@ -679,5 +701,4 @@ This project is licensed under the MIT license. See the [LICENSE](LICENSE) file
679
701
  [david-image]: https://david-dm.org/auth0/lock/status.svg?style=flat-square
680
702
  [david-url]: https://david-dm.org/auth0/lock
681
703
 
682
-
683
704
  [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fauth0%2Flock.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Flock?ref=badge_large)