From 106497dc278182c94ca7c77c4f8b3e3834fbc3ea Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 26 Jul 2016 18:57:11 +0200 Subject: [PATCH] Show the first input as a warning, not as an error box The first time the extension asks for the code of the mobile phone isn't an error and shouldn't be styles as such (see the depends-on change). Change all other UIs to errors. Bug: T139179 Change-Id: I7cc3333c3e166295e85e91c7b377e53842bdb307 Depends-On: I9a27911613e62b5c4cb86bea40696cb37c4f49c2 --- auth/TOTPSecondaryAuthenticationProvider.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/auth/TOTPSecondaryAuthenticationProvider.php b/auth/TOTPSecondaryAuthenticationProvider.php index 2ca930ac..af38fbf3 100644 --- a/auth/TOTPSecondaryAuthenticationProvider.php +++ b/auth/TOTPSecondaryAuthenticationProvider.php @@ -39,7 +39,7 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio return AuthenticationResponse::newAbstain(); } else { return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), - wfMessage( 'oathauth-auth-ui' ) ); + wfMessage( 'oathauth-auth-ui' ), 'warning' ); } } @@ -52,14 +52,17 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio $request = AuthenticationRequest::getRequestByClass( $reqs, TOTPAuthenticationRequest::class ); if ( !$request ) { return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), - wfMessage( 'oathauth-login-failed' ) ); + wfMessage( 'oathauth-login-failed' ), 'error' ); } $throttler = new Throttler( null, [ 'type' => 'TOTP' ] ); $result = $throttler->increase( $user->getName(), null, __METHOD__ ); if ( $result ) { return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), - new Message( 'oathauth-throttled', [ Message::durationParam( $result['wait'] ) ] ) ); + new Message( + 'oathauth-throttled', + [ Message::durationParam( $result['wait'] ) ] + ), 'error' ); } $oathuser = OATHAuthHooks::getOATHUserRepository()->findByUser( $user ); @@ -76,7 +79,7 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio return AuthenticationResponse::newPass(); } else { return AuthenticationResponse::newUI( array( new TOTPAuthenticationRequest() ), - wfMessage( 'oathauth-login-failed' ) ); + wfMessage( 'oathauth-login-failed' ), 'error' ); } }