Refactoring and adding logic to touch login/register template