Implement login functions and restrictions