Finished ajax auth. Must be a more elegant soln?