Refactored login filter . Bug fixed