Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/205864
Change subject: Track key authentication metrics
......................................................................
Track key authentication metrics
Fires a 'login' wfTrack event for logins via Special:UserLogin
and API action=login. Does not fire for implicit login after
account creation and for autologin (e.g. based on an active
CentralAuth global login).
Fires an 'accountcreation' track event for account creation via
Special:UserLogin/signup and API action=createaccount. Does not
fire for autocreation.
Both successful and unsuccessful attempts are tracked, except for
failures that throw exceptions (internal errors + some permission
errors).
Bug: T91701
Change-Id: I853f79a0e82f66eeb7c996505cf9f399292c3349
---
M includes/api/ApiCreateAccount.php
M includes/api/ApiLogin.php
M includes/specials/SpecialUserlogin.php
3 files changed, 25 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/64/205864/1
diff --git a/includes/api/ApiCreateAccount.php
b/includes/api/ApiCreateAccount.php
index b56a244..4c95d8f 100644
--- a/includes/api/ApiCreateAccount.php
+++ b/includes/api/ApiCreateAccount.php
@@ -90,6 +90,10 @@
$loginForm->load();
$status = $loginForm->addNewaccountInternal();
+ wfTrack( 'accountcreation', array(
+ 'successful' => $status->isGood(),
+ 'status' => $status->isGood() ? null :
$status->getMessage()->getKey(),
+ ) );
$result = array();
if ( $status->isGood() ) {
// Success!
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 5480d94..9187217 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -166,6 +166,11 @@
}
$this->getResult()->addValue( null, 'login', $result );
+
+ wfTrack( 'login', array(
+ 'successful' => $authRes === LoginForm::SUCCESS,
+ 'status' => $authRes,
+ ) );
}
public function mustBePosted() {
diff --git a/includes/specials/SpecialUserlogin.php
b/includes/specials/SpecialUserlogin.php
index 10edbcf..502ac73 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -338,6 +338,10 @@
}
$status = $this->addNewAccountInternal();
+ wfTrack( 'accountcreation', array(
+ 'successful' => $status->isGood(),
+ 'status' => $status->isGood() ? null :
$status->getMessage()->getKey(),
+ ) );
if ( !$status->isGood() ) {
$error = $status->getMessage();
$this->mainLoginForm( $error->toString() );
@@ -375,6 +379,11 @@
# Create the account and abort if there's a problem doing so
$status = $this->addNewAccountInternal();
+ wfTrack( 'accountcreation', array(
+ 'successful' => $status->isGood(),
+ 'status' => $status->isGood() ? null :
$status->getMessage()->getKey(),
+ ) );
+
if ( !$status->isGood() ) {
$error = $status->getMessage();
$this->mainLoginForm( $error->toString() );
@@ -909,7 +918,8 @@
global $wgMemc, $wgLang, $wgSecureLogin,
$wgPasswordAttemptThrottle,
$wgInvalidPasswordReset;
- switch ( $this->authenticateUserData() ) {
+ $status = $this->authenticateUserData();
+ switch ( $status ) {
case self::SUCCESS:
# We've verified now, update the real record
$user = $this->getUser();
@@ -1029,6 +1039,11 @@
default:
throw new MWException( 'Unhandled case value' );
}
+
+ wfTrack( 'login', array(
+ 'successful' => $status === self::SUCCESS,
+ 'status' => $status,
+ ) );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/205864
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I853f79a0e82f66eeb7c996505cf9f399292c3349
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits