Ejemplo n.º 1
0
void 
UserManager::UpdateWrongLoginCount( User *pUser, SsapiResponder *pResponder, bool wrongLogin ){

	UPDATE_INVALID_LOGIN_CELL	*pCell = new UPDATE_INVALID_LOGIN_CELL;
	U32							number = wrongLogin? pUser->GetNumberOfWrongLogins() + 1 : 0;

	pCell->pResponder	= pResponder;
	pCell->userId		= pUser->GetDesignatorId();
	pCell->numberOfWrongLogins = number;

	m_pUserTable->ModifyField(	pUser->GetDesignatorId().GetRowId(),
								ftUATE_NUMBER_OF_WRONG_LOGINS,
								&number,
								sizeof(number),
								(pTSCallback_t)METHOD_ADDRESS(UserManager, UpdateWrongLoginCountCallback),
								pCell );

	SetIsReadyToServiceRequests( false );

	if( number - 1 == WRONG_LOGIN_COUNT_BEFORE_ALARM ){
		Event		*pEvent = new Event( CTS_SSAPI_ALARM_TOO_MANY_WRONG_LOGINS );
		SsapiAlarmContextTooManyWrongLogins *pContext = new SsapiAlarmContextTooManyWrongLogins( pUser->GetDesignatorId() );

		// username as a parameter
		pEvent->AddEventParameter( pUser->GetUserName() );
	
		SubmitAlarm( (const Event*)pEvent, pContext, true );
	
		delete pContext;
		delete pEvent;
	}
}