modified login logic for gallery