fix(server): make account.reset a flow event
https://github.com/mozilla/fxa-auth-server/pull/1584 r=rfk
This commit is contained in:
Родитель
1d49428aa8
Коммит
ed9ec79565
|
@ -60,6 +60,7 @@ in a sign-in or sign-up flow:
|
||||||
|`account.verified`|A new account has been verified via email.|
|
|`account.verified`|A new account has been verified via email.|
|
||||||
|`account.keyfetch`|Sync encryption keys have been fetched.|
|
|`account.keyfetch`|Sync encryption keys have been fetched.|
|
||||||
|`account.signed`|A certificate has been signed.|
|
|`account.signed`|A certificate has been signed.|
|
||||||
|
|`account.reset`|An account has been reset.|
|
||||||
|`account.login.confirmedUnblockCode`|A user has successfully unblocked their account.|
|
|`account.login.confirmedUnblockCode`|A user has successfully unblocked their account.|
|
||||||
|`account.login.sentUnblockCode`|A sign-in unblock email has been sent to the user.|
|
|`account.login.sentUnblockCode`|A sign-in unblock email has been sent to the user.|
|
||||||
|`password.forgot.send_code.start`|A user has initiated the password reset flow.|
|
|`password.forgot.send_code.start`|A user has initiated the password reset flow.|
|
||||||
|
@ -203,6 +204,10 @@ in the preceding five days.
|
||||||
were fixed in the content server]
|
were fixed in the content server]
|
||||||
(https://github.com/mozilla/fxa-content-server/pull/4478).
|
(https://github.com/mozilla/fxa-content-server/pull/4478).
|
||||||
|
|
||||||
|
* [The `account.reset` event
|
||||||
|
was made a flow event]
|
||||||
|
(https://github.com/mozilla/fxa-auth-server/pull/1584).
|
||||||
|
|
||||||
### Train 75
|
### Train 75
|
||||||
|
|
||||||
* [The correct `service` parameter
|
* [The correct `service` parameter
|
||||||
|
|
|
@ -17,6 +17,7 @@ var StatsDCollector = require('./metrics/statsd')
|
||||||
// Don't log the error for those events.
|
// Don't log the error for those events.
|
||||||
const OPTIONAL_FLOW_EVENTS = {
|
const OPTIONAL_FLOW_EVENTS = {
|
||||||
'account.keyfetch': true,
|
'account.keyfetch': true,
|
||||||
|
'account.reset': true,
|
||||||
'account.signed': true
|
'account.signed': true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ const ACTIVITY_EVENTS = new Set([
|
||||||
const NOT_FLOW_EVENTS = new Set([
|
const NOT_FLOW_EVENTS = new Set([
|
||||||
'account.changedPassword',
|
'account.changedPassword',
|
||||||
'account.deleted',
|
'account.deleted',
|
||||||
'account.reset',
|
|
||||||
'device.created',
|
'device.created',
|
||||||
'device.deleted',
|
'device.deleted',
|
||||||
'device.updated'
|
'device.updated'
|
||||||
|
|
|
@ -1808,6 +1808,16 @@ module.exports = function (
|
||||||
var account, sessionToken, keyFetchToken, verifyHash, wrapKb, devicesToNotify
|
var account, sessionToken, keyFetchToken, verifyHash, wrapKb, devicesToNotify
|
||||||
var hasSessionToken = request.payload.sessionToken
|
var hasSessionToken = request.payload.sessionToken
|
||||||
|
|
||||||
|
request.validateMetricsContext()
|
||||||
|
|
||||||
|
let flowCompleteSignal
|
||||||
|
if (requestHelper.wantsKeys(request)) {
|
||||||
|
flowCompleteSignal = 'account.signed'
|
||||||
|
} else {
|
||||||
|
flowCompleteSignal = 'account.reset'
|
||||||
|
}
|
||||||
|
request.setMetricsFlowCompleteSignal(flowCompleteSignal)
|
||||||
|
|
||||||
return fetchDevicesToNotify()
|
return fetchDevicesToNotify()
|
||||||
.then(resetAccountData)
|
.then(resetAccountData)
|
||||||
.then(createSessionToken)
|
.then(createSessionToken)
|
||||||
|
@ -1888,14 +1898,6 @@ module.exports = function (
|
||||||
.then(
|
.then(
|
||||||
function (wrapKbData) {
|
function (wrapKbData) {
|
||||||
wrapKb = wrapKbData
|
wrapKb = wrapKbData
|
||||||
|
|
||||||
let flowCompleteSignal
|
|
||||||
if (requestHelper.wantsKeys(request)) {
|
|
||||||
flowCompleteSignal = 'account.signed'
|
|
||||||
} else {
|
|
||||||
flowCompleteSignal = 'account.login'
|
|
||||||
}
|
|
||||||
request.setMetricsFlowCompleteSignal(flowCompleteSignal)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,6 +365,9 @@ describe('/account/reset', function () {
|
||||||
assert.equal(securityEvent.ipAddr, clientAddress)
|
assert.equal(securityEvent.ipAddr, clientAddress)
|
||||||
assert.equal(securityEvent.name, 'account.reset')
|
assert.equal(securityEvent.name, 'account.reset')
|
||||||
|
|
||||||
|
assert.equal(mockMetricsContext.validate.callCount, 1, 'metricsContext.validate was called')
|
||||||
|
assert.equal(mockMetricsContext.validate.args[0].length, 0, 'validate was called without arguments')
|
||||||
|
|
||||||
assert.equal(mockMetricsContext.setFlowCompleteSignal.callCount, 1, 'metricsContext.setFlowCompleteSignal was called once')
|
assert.equal(mockMetricsContext.setFlowCompleteSignal.callCount, 1, 'metricsContext.setFlowCompleteSignal was called once')
|
||||||
args = mockMetricsContext.setFlowCompleteSignal.args[0]
|
args = mockMetricsContext.setFlowCompleteSignal.args[0]
|
||||||
assert.equal(args.length, 1, 'metricsContext.setFlowCompleteSignal was passed one argument')
|
assert.equal(args.length, 1, 'metricsContext.setFlowCompleteSignal was passed one argument')
|
||||||
|
|
Загрузка…
Ссылка в новой задаче