refactored login ftl/js