[Fix #351] Fixed sign-up page not redirecting

Also Refactored restore-path.js and added unit tests