Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@

**Fix**
- Bump dependencies versions (no breaking changes) [\#37](https://github.com/auth0/auth0-guardian.js/pull/37) ([dafortune](https://github.com/dafortune)).

# [v1.2.1](https://github.com/auth0/auth0-guardian.js/tree/v1.1.1) (2017-06-13)
[Full Changelog](https://github.com/auth0/auth0-guardian.js/compare/v1.2.1...v1.2.0)

**Fix**
- Fix enrollment:complete event in polling mode [\#37](https://github.com/auth0/auth0-guardian.js/pull/38) ([dafortune](https://github.com/dafortune)).
3 changes: 2 additions & 1 deletion lib/utils/polling_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ pollingClient.prototype.emitEvents = function emitEvents(err, oldState, newState
}

if (oldState && oldState.state === 'pending' &&
!oldState.enrollment && newState.enrollment) {
(!oldState.enrollment || oldState.enrollment.available_methods.length === 0) &&
(newState.enrollment && newState.enrollment.available_methods.length > 0)) {
self.hub.emit('enrollment:confirmed', object.toCamelKeys({
device_account: newState.enrollment,
tx_id: newState.id
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth0-guardian-js",
"version": "1.2.0",
"version": "1.2.1",
"description": "Interface",
"main": "index.js",
"directories": {
Expand Down
34 changes: 23 additions & 11 deletions test/utils/polling_client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,16 @@ describe('utils/polling_client', function () {
state: 'pending',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: ['sms']
}
},
events: [
{
name: 'enrollment:confirmed',
payload: {
deviceAccount: {
availableMethods: ['sms'],
id: 'dev_123',
test: 'test'
},
Expand All @@ -257,7 +259,8 @@ describe('utils/polling_client', function () {
state: 'accepted',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: ['push']
},
token: '123.123.1234'
},
Expand All @@ -267,7 +270,8 @@ describe('utils/polling_client', function () {
payload: {
deviceAccount: {
id: 'dev_123',
test: 'test'
test: 'test',
availableMethods: ['push']
},
txId: 'tx_1234'
}
Expand Down Expand Up @@ -296,7 +300,8 @@ describe('utils/polling_client', function () {
state: 'rejected',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: ['totp']
}
},
events: [
Expand All @@ -305,7 +310,8 @@ describe('utils/polling_client', function () {
payload: {
deviceAccount: {
id: 'dev_123',
test: 'test'
test: 'test',
availableMethods: ['totp']
},
txId: 'tx_1234'
}
Expand All @@ -328,15 +334,17 @@ describe('utils/polling_client', function () {
state: 'pending',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: []
}
},
transitionState: {
id: 'tx_1234',
state: 'rejected',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: []
}
},
events: [
Expand All @@ -358,15 +366,17 @@ describe('utils/polling_client', function () {
state: 'pending',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: []
}
},
transitionState: {
id: 'tx_1234',
state: 'accepted',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: []
},
token: '123.123.1234'
},
Expand Down Expand Up @@ -395,7 +405,8 @@ describe('utils/polling_client', function () {
state: 'accepted',
enrollment: {
id: 'dev_123',
test: 'test'
test: 'test',
available_methods: ['totp']
},
token: '123.123.1234'
},
Expand All @@ -405,7 +416,8 @@ describe('utils/polling_client', function () {
payload: {
deviceAccount: {
id: 'dev_123',
test: 'test'
test: 'test',
availableMethods: ['totp']
},
txId: 'tx_1234'
}
Expand Down