supplied angular validation
fixed cookie not initiated inside condition