Fully function for Register & Login