Skip to content

Commit 66bc1ef

Browse files
Merge pull request #789 from masteradhoc/patch-1
optimize email text for totp Co-authored-by: masteradhoc <masteradhoc@git.wordpress.org> Co-authored-by: kasparsd <kasparsd@git.wordpress.org>
2 parents ddf09ad + 8a7dec3 commit 66bc1ef

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎providers/class-two-factor-email.php‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,24 +261,27 @@ private function get_client_ip() {
261261
public function generate_and_email_token( $user ) {
262262
$token = $this->generate_token( $user->ID );
263263
$remote_ip = $this->get_client_ip();
264+
$ttl_minutes = (int) ceil( $this->user_token_ttl( $user->ID ) / MINUTE_IN_SECONDS );
264265

265266
$subject = wp_strip_all_tags(
266267
sprintf(
267268
/* translators: %s: site name */
268-
__( 'Your login confirmation code for %s', 'two-factor' ),
269+
__( '[%s] Login confirmation code', 'two-factor' ),
269270
wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
270271
)
271272
);
272273

273274
$message_parts = array(
275+
__( 'Please complete the login by entering the verification code below:', 'two-factor' ),
276+
$token,
274277
sprintf(
275-
/* translators: %s: token */
276-
__( 'Enter %s to log in.', 'two-factor' ),
277-
$token
278+
/* translators: %d: number of minutes */
279+
__( 'This code will expire in %d minutes.', 'two-factor' ),
280+
$ttl_minutes
278281
),
279282
sprintf(
280-
/* translators: $1$s: IP address of user, %2$s: `user_login` of authenticated user */
281-
__( 'Didn\'t expect this? A user from %1$s has successfully authenticated as %2$s. If this wasn\'t you, please change your password.', 'two-factor' ),
283+
/* translators: $1$s: IP address of user, $2$s: user login */
284+
__( 'A user from IP address %1$s has successfully authenticated as %2$s. If this wasn\'t you, please change your password.', 'two-factor' ),
282285
$remote_ip,
283286
$user->user_login
284287
),

0 commit comments

Comments
 (0)