/// <summary> /// Command method /// </summary> public void Execute() { Validation = string.Empty; //Check Internet Availability if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == true) { bool approved = _model.Authenticate(this.Username, this.Password); if (approved == true) { UploadView _view = new UploadView(); _view.ShowDialog(); var mainWindow = (Application.Current.MainWindow as LoginView); if (mainWindow != null) { mainWindow.Close(); } } else { Validation = "Invalid Username Password !!"; } } else { Validation = "Check Your Internet Connection !!"; } }
public async void Login() { IsBusy = true; if (User != null && Password != null) { usuario = await LoginModel.Authenticate(User, Password); if (usuario.UserID > 0) { await autoLookViewModel.setLoggedUser(usuario); if (usuario.Type == 2) //Admin = 2 { autoLookViewModel.IsAdmin = true; } else { autoLookViewModel.IsAdmin = false; } if (Recordar == true) { UserSystem.DeleteUserRealm(usuario.UserID); UserSystem UserSys = new UserSystem { UserID = usuario.UserID, Email = usuario.Email, Pass = usuario.Password, Remember = true }; UserSystem.SaveUserRealm(UserSys); } autoLookViewModel.IsLogged = true; IsBusy = false; await App.Current.MainPage.DisplayAlert("Bienvenido!", usuario.Name + " " + usuario.LastName, "OK"); } else { autoLookViewModel.IsLogged = false; await App.Current.MainPage.DisplayAlert("OOOPS", "Error de Login ", "OK"); IsBusy = false; } autoLookViewModel.PageManager(1); User = ""; Password = ""; Recordar = false; } else { await App.Current.MainPage.DisplayAlert("OOOPS", "Debe completar todos los espacios. ", "OK"); IsBusy = false; } }
public void AuthenticationWorks() { // arrange var loginModel = new LoginModel(); var userName = "******"; var password = "******"; // act var result = loginModel.Authenticate(userName, password); // assert Assert.IsTrue(result, "Authentication failed with the " + "proper username and password"); }
public void AuthenticationFails() { // arrange var loginModel = new LoginModel(); var username = "******"; var password = "******"; // act var result = loginModel.Authenticate(username, password); // assert Assert.IsFalse(result, "Authentication succeeded" + "when it should have failed."); }
public async Task <ActionResult> PersonalInfoChoice(LoginModel loginModel) { // Authenticates the client int?clientID = await loginModel.Authenticate(_clientRepo); // If the client ID is not null, that means the authentication was succesful if (clientID != null) { // Create a cookie and redirect to the next step AddClientCookie((int)clientID); return(RedirectToAction("DeliveryOption", "Orders")); } else { // If the client ID is null, that means that either the password was wrong, or that no user was found ModelState.AddModelError("", Resources.Global.LoginFailedCredentials); } ViewBag.LoginModel = loginModel; return(View()); }