mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/LoginNotify
synced 2024-11-15 11:11:02 +00:00
Merge "Change wording to distinguish between new and known devices. Add PLURAL for single/multiple attempts. Separate notifications for new/known devices."
This commit is contained in:
commit
1aec4a16bd
|
@ -89,7 +89,6 @@ class LoginNotifyHooks {
|
|||
|
||||
public static function onEchoGetBundleRules( $event, &$bundleString ) {
|
||||
switch ( $event->getType() ) {
|
||||
case 'login-fail-known':
|
||||
case 'login-fail-new':
|
||||
$bundleString = 'login-fail';
|
||||
break;
|
||||
|
|
|
@ -27,17 +27,34 @@ class LoginNotifyPresentationModel extends EchoEventPresentationModel {
|
|||
public function getHeaderMessage() {
|
||||
// Check if we got a bundled notification with a 'count' param
|
||||
// 'count' param is set when we have a failed login attempt
|
||||
if ( $this->isBundled() && ( $this->event->getExtraParam( 'count', 0 ) > 0 ) ) {
|
||||
$msg = $this->msg( 'notification-bundled-header-login-fail' );
|
||||
$msg->params( $this->event->getExtraParam( 'count', 0 ) );
|
||||
return $msg;
|
||||
} elseif ( $this->event->getExtraParam( 'count', 0 ) > 0 ) {
|
||||
$msg = $this->msg( 'notification-unbundled-header-login-fail' );
|
||||
return $msg;
|
||||
} else {
|
||||
$msg = $this->msg( 'notification-header-login-success' );
|
||||
return $msg;
|
||||
$msg = '';
|
||||
switch ( $this->event->getType() ) {
|
||||
case 'login-fail-known':
|
||||
if ( $this->event->getExtraParam( 'count', 0 ) > 0 ) {
|
||||
$msg = $this->msg( 'notification-known-header-login-fail' );
|
||||
$msg->params( $this->event->getExtraParam( 'count', 0 ) );
|
||||
return $msg;
|
||||
} else {
|
||||
$msg = $this->msg( 'notification-header-login-success' );
|
||||
$msg->params( $this->event->getExtraParam( 'count', 0 ) );
|
||||
return $msg;
|
||||
}
|
||||
break;
|
||||
case 'login-fail-new':
|
||||
if ( $this->isBundled() && ( $this->event->getExtraParam( 'count', 0 ) > 0 ) ) {
|
||||
$msg = $this->msg( 'notification-new-bundled-header-login-fail' );
|
||||
$msg->params( $this->event->getExtraParam( 'count', 0 ) );
|
||||
return $msg;
|
||||
} elseif ( $this->event->getExtraParam( 'count', 0 ) > 0 ) {
|
||||
$msg = $this->msg( 'notification-new-unbundled-header-login-fail' );
|
||||
return $msg;
|
||||
} else {
|
||||
$msg = $this->msg( 'notification-header-login-success' );
|
||||
return $msg;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
"notification-loginnotify-login-fail-email-subject": "{{PLURAL:$2|Failed attempt|Multiple failed attempts}} to log in to {{SITENAME}} as $1",
|
||||
"notification-loginnotify-login-success-email-subject": "Login to {{SITENAME}} as $1 from a computer you have not recently used",
|
||||
"notification-header-login-success": "Someone has successfully logged into your account from a computer which you have not edited from recently.",
|
||||
"notification-loginnotify-login-fail-new-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account '$1' on {{SITENAME}}. If this was you, then you can disregard this message. If it wasn't, please make sure your account has a strong password.",
|
||||
"notification-loginnotify-login-fail-known-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account, '$1' on {{SITENAME}}. If this was you, then you can disregard this message. If it wasn't, please make sure your account has a strong password.",
|
||||
"notification-loginnotify-login-fail-new-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account '$1' on {{SITENAME}}. If it wasn't you, please make sure your account has a strong password.",
|
||||
"notification-loginnotify-login-fail-known-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account, '$1' on {{SITENAME}}. If it wasn't you, please make sure your account has a strong password.",
|
||||
"notification-loginnotify-login-success-emailbatch": "Someone has successfully logged into your account '$1' on {{SITENAME}} from a computer which you have not edited from recently.",
|
||||
"notification-bundled-header-login-fail": "There have been '''$1 failed attempts''' to login to your account since the last time you logged in. If this was you, then you can disregard this message. If it wasn't, please make sure your account has a strong password.",
|
||||
"notification-unbundled-header-login-fail": "There have been multiple failed login attempts to your account. Please make sure your account has a strong password."
|
||||
"notification-new-bundled-header-login-fail": "There {{PLURAL:$1|has been '''a failed attempt'''|have been '''$1 failed attempts'''}} to log in to your account from a new device since the last time you logged in. If it wasn't you, please make sure your account has a strong password.",
|
||||
"notification-known-header-login-fail": "There have been {{PLURAL:$1|has been '''a failed attempt'''|have been '''$1 failed attempts'''}} to log in to your account since the last time you logged in. If it wasn't you, please make sure your account has a strong password.",
|
||||
"notification-new-unbundled-header-login-fail": "There have been multiple failed attempts to log in to your account from a new device. Please make sure your account has a strong password."
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"notification-loginnotify-login-fail-new-emailbatch": "Body of email notification that someone from a computer not previously used by the user has attempted and failed to log into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-fail-email-subject}}. $1 is account name. $2 is the number of attempts",
|
||||
"notification-loginnotify-login-fail-known-emailbatch": "Body of email notification that someone from a computer which has been previously used by the user has attempted and failed to log into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-fail-email-subject}}. $1 is account name. $2 is the number of attempts",
|
||||
"notification-loginnotify-login-success-emailbatch": "Body of email notification that someone from a computer not previously used by the user has succesfully logged into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-success-email-subject}}. $1 is account name.",
|
||||
"notification-bundled-header-login-fail": "Message string shown for bundled notifications",
|
||||
"notification-unbundled-header-login-fail": "Message string shown for individual notifications when the bundle disperses"
|
||||
"notification-new-bundled-header-login-fail": "Message string shown for bundled notifications for login attempts from a new device",
|
||||
"notification-known-header-login-fail": "Message string shown for known IP notifications",
|
||||
"notification-new-unbundled-header-login-fail": "Message string shown for individual notifications for login attempts from a new device, when the bundle disperses"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue