예제 #1
0
        public string Register()
        {
            _console.WriteLine("Email:");
            string email = _console.ReadLine();

            if (!email.Contains("@"))
            {
                return("Email should contain '@' symbol.");
            }
            var registeredEmails = _repo.GetAllUsers().Select(u => u.email);

            if (registeredEmails.Contains(email))
            {
                return("Email already registered.");
            }

            _console.WriteLine("Password:"******"Confirm password:"******"Passwords don't match!");
            }

            User newUser = _repo.AddUser(email, password);

            NotifyOfLogginIn?.Invoke(newUser);
            return("Registered");
        }
예제 #2
0
        public string LogIn()
        {
            _console.WriteLine("Email:");
            string email = _console.ReadLine();

            _console.WriteLine("Password:"******"WellCome back!");
            }
            else
            {
                return("Wrong email or password");
            }
        }