notifications: Store number of keys in notification data

We want to customize the message depending on the number of active
devices, for example "an authentication device was removed" vs
"two-factor has been disabled".

Bug: T353962
Change-Id: Iaeb119a7cc6c264c4e49edeb3a88453786547021
This commit is contained in:
Taavi Väänänen 2023-12-25 13:21:31 +02:00
parent 97abce5e90
commit 095f91815b
No known key found for this signature in database
GPG key ID: EF242F709F912FBE
2 changed files with 6 additions and 1 deletions

View file

@ -55,6 +55,7 @@ class Manager {
'agent' => $oUser->getUser(),
'extra' => [
'self' => $self,
'activeDevices' => count( $oUser->getKeys() ),
]
] );
}
@ -71,7 +72,10 @@ class Manager {
Event::create( [
'type' => 'oathauth-enable',
'title' => SpecialPage::getTitleFor( 'Preferences' ),
'agent' => $oUser->getUser()
'agent' => $oUser->getUser(),
'extra' => [
'activeDevices' => count( $oUser->getKeys() ),
],
] );
}
}

View file

@ -253,6 +253,7 @@ class OATHUserRepository implements LoggerAwareInterface {
'clientip' => $clientInfo,
'oathtype' => $user->getModule()->getName(),
] );
Manager::notifyDisabled( $user, $self );
}
}