Updated Login-Function