Newly created users are unable log into multi-tenant application??

Newly created users are unable log into multi-tenant application??

  
I have made an application as multitentant .I have reused the code of Sales,SelfRegister,TenantManagement to create Tenants and associating users to it. But the newly created users are not able to login to the application.Its throwing .ExcptWebReferenceError: Unable to login. User is unknown or no longer active.As I bebugged found that the below query is returning blank results.
select *  from ossys_Espace_Tenant,UserMT where
ossys_Espace_Tenant.Tenant_Id = UserMT.Tenant_Id
and ossys_Espace_Tenant.Espace_Id = GetEntryEspaceId()[In my case its 231]
and ossys_Espace_Tenant.Is_Active = True
and UserMT.Username='NEW_USER'; 
The above query is part of User_Login action and GetUser aggregate.

2.I could not able to see data inside UserMT entity .Whats the reason.Is it beacuse the show tenant identifier is checked.But able to see the below data.
Select * from ossys_Espace_Tenant;

Please help to reslove/point out the issue.
If the show tenant identifier is checked , then you have to paas the tenantid in where condition.
The UserProvider for creating users for tenant and for the main application was diffrent which was resulting the failure of the query.

I am stuck in a situation where the User which I created was returning a valid user id but I am unable to use that id to insert in other related table .when I go the DB user id is not present .