fixed swap js function and handling admin login