Build login via js
Fix validation error in js + refactor