File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1313 **/
1414
1515use App \Http \Utils \IUserIPHelperProvider ;
16+ use App \Jobs \AddUserAction ;
1617use App \libs \Auth \Models \IGroupSlugs ;
1718use App \libs \OAuth2 \Repositories \IOAuth2OTPRepository ;
1819use App \Models \OAuth2 \Factories \OTPFactory ;
7374use Utils \Db \ITransactionService ;
7475use Utils \Exceptions \ConfigurationException ;
7576use Utils \Exceptions \UnacquiredLockException ;
77+ use Utils \IPHelper ;
7678use utils \json_types \JsonValue ;
7779use utils \json_types \NumericDate ;
7880use utils \json_types \StringOrURI ;
@@ -1610,10 +1612,26 @@ public function createOTPFromRequest(OAuth2PasswordlessAuthenticationRequest $re
16101612 * @throws Exception
16111613 */
16121614 public function createOTPFromPayload (array $ payload , ?Client $ client ):OAuth2OTP {
1615+
16131616 $ otp = $ this ->tx_service ->transaction (function () use ($ payload , $ client ){
16141617
16151618 $ otp = OTPFactory::buildFromPayload ($ payload , $ this ->identifier_generator , $ client );
16161619
1620+ $ user = $ this ->auth_service ->getUserByUsername ($ otp ->getUserName ());
1621+ if (!is_null ($ user )){
1622+ Log::debug
1623+ (
1624+ sprintf
1625+ (
1626+ "TokenService::createOTPFromPayload requested OTP for existent user %s (%s) " ,
1627+ $ user ->getEmail (),
1628+ $ user ->getId ()
1629+ )
1630+ );
1631+ AddUserAction::dispatch ($ user ->getId (), IPHelper::getUserIp (), "Requested OTP " );
1632+ if (!$ user ->isActive ())
1633+ throw new ValidationException ("User is not active. " );
1634+ }
16171635 if (is_null ($ client )){
16181636 $ this ->otp_repository ->add ($ otp );
16191637 }
Original file line number Diff line number Diff line change @@ -444,6 +444,12 @@ class LoginPage extends React.Component {
444444 } ) ;
445445 } , ( error ) => {
446446 let { response, status, message} = error ;
447+ if ( status == 412 ) {
448+ const { message, errors} = response . body ;
449+ Swal ( message , errors [ 0 ] , 'error' )
450+ return ;
451+ }
452+
447453 Swal ( 'Oops...' , 'Something went wrong!' , 'error' )
448454 } ) ;
449455 return false ;
You can’t perform that action at this time.
0 commit comments