private void btn_Click(object sender, RoutedEventArgs e) { Button clickBtn = (Button)sender; if (clickBtn.Content.ToString() == "Sign Up!") { SignUp signUpWindow = new SignUp(); App.Current.MainWindow = signUpWindow; this.Close(); signUpWindow.Show(); } else if (clickBtn.Content.ToString() == "Login") // Need to add extra parameters for adding the correct user information { LoginMethods loginMethods = new LoginMethods(); userID = loginMethods.emailCheck(emailText.Text, passwordTxt.Password); if (userID > 0) { Library libraryWindow = new Library(); App.Current.MainWindow = libraryWindow; this.Close(); libraryWindow.Show(); } else { invalidLoginTxt.Text = "Login Failed - Invalid Username or Password"; } } else if (clickBtn.Content.ToString() == "Admin") // Need to add extra parameters for adding the correct user information { Admin AdminWindow = new Admin(); App.Current.MainWindow = AdminWindow; this.Close(); AdminWindow.Show(); } }
public void WhenAuthing_LoginMethodValidatorIsChecked(LoginMethods i_method) { MockPreferredLogin.LoginMethod.Returns(i_method); systemUnderTest.Authenticate(); MockLoginMethodValidator.Received().IsValid(i_method); }
public void AttemptToLink(LoginMethods i_linkType, Callback <AccountLinkResultTypes> i_callback) { switch (i_linkType) { case LoginMethods.Google: GoogleLinker.AttemptLink(i_callback); break; } }
public void WhenAuthing_IfMethodIsNotValid_MethodIsDefaultedToDeviceId(LoginMethods i_method) { MockPreferredLogin.LoginMethod.Returns(i_method); MockLoginMethodValidator.IsValid(i_method).Returns(false); systemUnderTest.Authenticate(); Assert.AreEqual(LoginMethods.DeviceId, MockPreferredLogin.LoginMethod); }
public bool IsValid(LoginMethods i_method) { if (i_method == LoginMethods.DeviceId) { return(true); } else { UnityEngine.Debug.LogError("Checking is authed: " + Social.localUser.authenticated); return(Social.localUser.authenticated); } }
public void AttemptForceLink(LoginMethods i_linkType, Callback <bool> i_callback) { bool forceLink = true; switch (i_linkType) { case LoginMethods.Google: GoogleLinker.AttemptLink((result) => { bool success = result == AccountLinkResultTypes.SuccessfulLink; i_callback(success); }, forceLink); break; } }
public void LoginUserTest(ISignedUser externalValidUsers) { //Arrange LoginMethods login = new LoginMethods(); string expectedResult = "ALREADY REGISTERED?"; string expectedResult2 = "MY ACCOUNT"; //Step 1 string actualResult = login.GoToAuthentication().GetTextLogoAlreadyRegistered(); Assert.AreEqual(expectedResult, actualResult, "Step1: Go to Authentication page "); //Step 2 string actualResult2 = login.InputEmailPasswordForLogin(externalValidUsers).GetTextTitleMyAccount(); Assert.AreEqual(expectedResult2, actualResult2, "Step 2: User on MyAccount page"); }
//[Test, TestCaseSource("ValidUsers")] public void MultipleLoginUserTest(IApplicationSource applicationSource, ISignedUser validUsers) { //Arrange Application.GetMultipleBrowser(applicationSource).BaseUrlAction(); LoginMethods login = new LoginMethods(); string expectedResult = "ALREADY REGISTERED?"; string expectedResult2 = "MY ACCOUNT"; //Step 1 string actualResult = login.GoToAuthentication().GetTextLogoAlreadyRegistered(); Assert.AreEqual(expectedResult, actualResult, "Step1: Go to Authentication page "); //Step 2 string actualResult2 = login.InputEmailPasswordForLogin(validUsers).GetTextTitleMyAccount(); Assert.AreEqual(expectedResult2, actualResult2, "Step 2: User on MyAccount page"); }
public void AfterLogin_IfNotUsingDeviceId_LinkDeviceToAccount(LoginMethods i_method) { MockPreferredLogin.LoginMethod.Returns(i_method); MockLoginMethodValidator.IsValid(i_method).Returns(true); IBasicBackend mockBackend = Substitute.For <IBasicBackend>(); MockBackendManager.GetBackend <IBasicBackend>().Returns(mockBackend); systemUnderTest.OnLogin(); if (i_method != LoginMethods.DeviceId) { mockBackend.Received().LinkDeviceToAccount(Arg.Any <Callback <bool> >()); } }
public ActionResult Login(string UserName, string Password) { //var pasassas = EncryptDecrypt.Encrypt("PA$$W0RD"); bool flag = false; string action = string.Empty; if (new UserDataAccess().GetUserByUserID(UserName) != null /*LoginMethods.ValidateLogin(UserName)*/) { flag = LoginMethods.Login(UserName, Password); //DB login //flag = Auth(UserName, Password); //AD login var userId = LoginMethods.IsUserExists(UserName); if (flag) { bool IsDBExist = LoginMethods.Login2(UserName);//AD login if (IsDBExist == false) { return(Json(new { IsSuccess = flag, ErrorMessage = (flag == true) ? string.Empty : "User Not Exist in System", Response = (flag == true) ? action : null }, JsonRequestBehavior.AllowGet)); } bool expiry = LoginMethods.CheckExpiry(UserName); if (expiry == false) { return(Json(new { IsSuccess = false, ErrorMessage = "User Access Expired", Response = "" }, JsonRequestBehavior.AllowGet)); } LoginMethods.AddUserLog(userId.GetValueOrDefault(), userId.GetValueOrDefault()); } else { if (userId > 0) { LoginMethods.AddUserLog(userId.GetValueOrDefault()); } } action = Url.Action("DashboardView", "Base"); return(Json(new { IsSuccess = flag, ErrorMessage = (flag == true) ? string.Empty : CustomMessages.InvalidUsernameOrPassword, Response = (flag == true) ? action : null }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = flag, ErrorMessage = (flag == true) ? string.Empty : CustomMessages.UserNotExists, Response = (flag == true) ? action : null }, JsonRequestBehavior.AllowGet)); } }
public IHttpActionResult Authenticate(LoginRequest login) { if (login == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } //TODO: Validate credentials correctly, this code is only for demo!! bool isCredentialValid = (login.Password == LoginMethods.GetUserPassword(login.Username)); if (isCredentialValid) { var token = TokenGenerator.GenerateTokenJwt(login.Username); return(Ok(token)); } else { return(Unauthorized()); } }
public void OnClick(LoginMethods i_loginMethod) { mMethod = i_loginMethod; AccountLinker.AttemptToLink(i_loginMethod, OnLinkResult); }