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

Commit

Permalink
add property to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
udaraweerasinghege committed Jul 19, 2017
1 parent a0c58ef commit 32a0827
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 6 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,12 @@ for the authenticated user.

<!--end-response-body-get-accountsessions-isCurrentDevice-->

* `isMemoryToken`: *boolean*

<!--begin-response-body-get-accountsessions-isMemoryToken-->

<!--end-response-body-get-accountsessions-isMemoryToken-->


#### POST /account/device/destroy

Expand Down
6 changes: 4 additions & 2 deletions lib/routes/devices-sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ module.exports = (log, db, config, customs, push, devices) => {
deviceCallbackPublicKey: isA.string().max(88).regex(URL_SAFE_BASE_64).optional().allow('').allow(null),
deviceCallbackAuthKey: isA.string().max(24).regex(URL_SAFE_BASE_64).optional().allow('').allow(null),
isDevice: isA.boolean().required(),
isCurrentDevice: isA.boolean().required()
isCurrentDevice: isA.boolean().required(),
isMemoryToken: isA.boolean()
}))
}
},
Expand Down Expand Up @@ -372,7 +373,8 @@ module.exports = (log, db, config, customs, push, devices) => {
request.headers['accept-language']
),
os: session.uaOS,
userAgent
userAgent,
isMemoryToken: session.isMemoryToken || false
}
}))
},
Expand Down
15 changes: 10 additions & 5 deletions test/local/routes/devices-sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,15 @@ describe('/account/sessions', () => {
tokenId: tokenIds[0], uid: 'qux', createdAt: times[0], lastAccessTime: times[1],
uaBrowser: 'Firefox', uaBrowserVersion: '50', uaOS: 'Windows', uaOSVersion: '10',
uaDeviceType: null, deviceId: null, deviceCreatedAt: times[2],
deviceCallbackURL: 'callback', deviceCallbackPublicKey: 'publicKey', deviceCallbackAuthKey: 'authKey'
deviceCallbackURL: 'callback', deviceCallbackPublicKey: 'publicKey', deviceCallbackAuthKey: 'authKey',
isMemoryToken: true
},
{
tokenId: tokenIds[1], uid: 'wibble', createdAt: times[3], lastAccessTime: times[4],
uaBrowser: 'Nightly', uaBrowserVersion: null, uaOS: 'Android', uaOSVersion: '6',
uaDeviceType: 'mobile', deviceId: 'deviceId', deviceCreatedAt: times[5],
deviceCallbackURL: null, deviceCallbackPublicKey: null, deviceCallbackAuthKey: null
deviceCallbackURL: null, deviceCallbackPublicKey: null, deviceCallbackAuthKey: null,
isMemoryToken: true
},
{
tokenId: tokenIds[2], uid: 'blee', createdAt: times[6], lastAccessTime: times[7],
Expand Down Expand Up @@ -559,7 +561,8 @@ describe('/account/sessions', () => {
lastAccessTime: times[1],
lastAccessTimeFormatted: 'a few seconds ago',
os: 'Windows',
userAgent: 'Firefox 50'
userAgent: 'Firefox 50',
isMemoryToken: true
},
{
deviceId: 'deviceId',
Expand All @@ -574,7 +577,8 @@ describe('/account/sessions', () => {
lastAccessTime: times[4],
lastAccessTimeFormatted: 'a few seconds ago',
os: 'Android',
userAgent: 'Nightly'
userAgent: 'Nightly',
isMemoryToken: true
},
{
deviceId: 'deviceId',
Expand All @@ -589,7 +593,8 @@ describe('/account/sessions', () => {
lastAccessTime: times[7],
lastAccessTimeFormatted: 'a few seconds ago',
os: null,
userAgent: ''
userAgent: '',
isMemoryToken: false
},
])
})
Expand Down

0 comments on commit 32a0827

Please sign in to comment.