public ActionResult Login(User user) { var loginmethod = new LoginLogic(); loginmethod.Login(user.user_mail, user.user_password); return(View()); }
public ActionResult Index(IndexModel model) { if (!ModelState.IsValid) { return(View(model)); } else { LoginLogic loginLogic = new LoginLogic(); if (loginLogic.Login(model.Username, model.Password) != null) { HttpContext.Session.SetString("Username", model.Username); if (loginLogic.CheckIfAdmin(model.Username)) { return(RedirectToAction("Index", "Admin")); } else { return(RedirectToAction("Index", "Dashboard")); } } else { TempData["Succes"] = "U bent niet ingelogd"; return(RedirectToAction("Index")); } } }
/// <summary> /// 重发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnRepeat_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (!PhoneHelper.ValidateMobile(PhoneNo.Text)) { MessageBox.Show("手机号格式不正确!"); return; } else { //发短信 LoginLogic logic = new LoginLogic(); ResultModel model = logic.SendMessage(InterfacePath.Default.SendMessage, PhoneNo.Text, CheckCodeTypeEnum.RESET_PASSWORD.ToString()); if (model.code == 200) { secondCount = 59; BtnRepeat.Content = "重发"; this.timer.Start(); } else { string result = ((MessageStateEnum)model.code).ToString(); Log4Helper.Error(this.GetType(), $"手机号:{PhoneNo.Text}发送重置密码短信失败!原因:{result}"); MessageBox.Show(result); } } }
public void Sure() { try { if (!PhoneHelper.ValidateMobile(UserName)) { SendMsg("resetPassWord", "userNameError"); return; } if (CheckCode == "") { SendMsg("resetPassWord", "checkCodeError"); return; } if (Password == "") { SendMsg("resetPassWord", "passWordError"); return; } var result = new LoginLogic().ResetPassWord(InterfacePath.Default.ResetPassWord, CheckCode, UserName, Password); SendMsg("resetPassWord", result.code.ToString()); Log4Helper.Info(this.GetType(), $"手机号:{UserName},找回密码:{result.msg}"); } catch (Exception ex) { SendMsg("resetPassWord", "Error"); Log4Helper.Error(this.GetType(), ex); } }
public async Task WillCallTestLoginMethodOnIsUserLoggedInAsync() { var logic = new LoginLogic(_oAuthManager, null, null, _tokenRepository, _userRepository, _preferencesRepository, _updateRepository, _donateIntentRepo); const string tokenString = "Some String"; _tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = tokenString, Secret = null }); _userRepository.Expect(t => t.Get()).Return(new User()); _oAuthManager.Expect(o => o.MakeAuthenticatedRequestAsync(Arg <string> .Is.Anything, Arg <IDictionary <string, string> > .Is.Anything)) .Return(Task.FromResult <dynamic>((dynamic) new Dictionary <string, object>())); var applyUser = new Action <User>(delegate { }); await logic.IsUserLoggedInAsync(applyUser); _tokenRepository.VerifyAllExpectations(); _userRepository.VerifyAllExpectations(); _oAuthManager.VerifyAllExpectations(); }
public AlteracaoSenhaViewModel() { _usuarioLogic = new UsuarioLogic(); _loginLogic = new LoginLogic(); Init(); }
/// <summary> /// Register user action /// </summary private void RegisterNewUser(object param) { if (!string.IsNullOrEmpty(LName) && !string.IsNullOrEmpty(FName) && !string.IsNullOrEmpty(Organization) && !string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Password)) { var userLogic = new LoginLogic(); //Validate Email var status = userLogic.ValidateEmail(user.Email); if (status) { userLogic.CreateUserInfo(user); string licenseType = param.ToString(); if (licenseType == "Trial") { var logic = new LicenseLogic(); SingletonLicense.Instance.SelectedSubscription = logic.GetTrialLicense(); logic.ActivateSubscription(); } var dict = new Dictionary <string, string>(); dict.Add("licenseType", licenseType); if (NavigateNextPage != null) { NavigateNextPage(null, dict); } } else { MessageBox.Show("Email Address already Exist"); } } }
private async void RealizaLogin() { try { indicator.IsVisible = true; btConfirma.IsEnabled = false; var loginLogic = new LoginLogic(); App.current.sdsSenha = entrySenha.Text; App.current.sdsUsuario = entryUsuario.Text; var bboOk = await loginLogic.VerificaLogin(entryUsuario.Text); if (bboOk) { App.current.AfterLogin(); } else { throw new Exception(); } } catch { await DisplayAlert("Ops", "Usuário ou senha inválido", "Ok"); } finally { indicator.IsVisible = false; btConfirma.IsEnabled = true; } }
public async void Login() { try { string loginResult = await LoginLogic.GetLoginResponse(User.EmpId, User.Password); if (loginResult == "true") { Helpers.Data.User = User; SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation); conn.CreateTable <User>(); conn.Execute("Delete from User"); int rows = conn.Insert(User); conn.Close(); if (rows == 1) { App.Current.MainPage = (new HomePage()); } else { await App.Current.MainPage.DisplayAlert("Error", "Failed to Log In ", "OK"); } } else if (loginResult == "false") { await App.Current.MainPage.DisplayAlert("Error", "Employee ID or Password incorrect", "OK"); } } catch (Exception ex) { } }
private void frmLogin_Load(object sender, EventArgs e) { if (LoginLogic.LoginFromSession()) { RunMainForm(); } }
// Start is called before the first frame update void Start() { GameObject infoLogObject = GameObject.Find("InfoLog"); infoLogObject.GetComponent <Canvas>().enabled = false; infoLogAnimator = infoLogObject.GetComponent <Animator>(); GameObject loginWindow = GameObject.Find("LoginWindow"); loginLogic = loginWindow.GetComponent <LoginLogic>(); GameObject informationWindow = GameObject.Find("InformationWindow"); informationLogic = informationWindow.GetComponent <InformationLogic>(); GameObject registerWindow = GameObject.Find("RegisterWindow"); registerLogin = registerWindow.GetComponent <RegisterLogin>(); GameObject mainMenuWindow = GameObject.Find("MainMenuWindow"); mainMenuLogic = mainMenuWindow.GetComponent <MainMenuLogic>(); GameObject gameCreationWindow = GameObject.Find("GameCreationWindow"); gameCreationLogic = gameCreationWindow.GetComponent <GameCreationLogic>(); GameObject invitationWindow = GameObject.Find("InvitationWindow"); invitationLogic = invitationWindow.GetComponent <InvitationLogic>(); GameObject joinAGameWindow = GameObject.Find("JoinAGameWindow"); joinAGameLogic = joinAGameWindow.GetComponent <JoinAGameLogic>(); connectToServer(); }
// Check login credentials and show dashboard public ActionResult Dashboard() { CinemaViewModel model = (CinemaViewModel)TempData["model"]; // Request input from cash register login string username = Request["username"]; string password = Request["password"]; // No user input if (username == "" || password == "") { return(RedirectToAction("ManagerLogin", "Login", new { error = "Vul a.u.b. beide velden in" })); } else { // Get all logins IEnumerable <ManagerLogin> allLogins = repo.GetLogins(); // Check if username and password exist in database bool exists = LoginLogic.CheckManagerLogin(username, password, allLogins); if (exists == true) { model.LoggedInUser = username; model.loggedInManager = true; TempData["model"] = model; return(View("Dashboard", model)); } // No right username - password combination else { return(RedirectToAction("ManagerLogin", "Login", new { error = "Deze combinatie van gebruikersnaam en wachtwoord kon niet gevonden worden" })); } } }
public void ExitToServerList(bool bQuick = false) { Action action = () => { const string sceneName = "Login"; ResourceManager.PrepareScene(Resource.GetScenePath(sceneName), www => { LoginLogic.State = LoginLogic.LoginState.LoginSuccess; ResourceManager.Instance.StartCoroutine(ResourceManager.LoadSceneImpl(sceneName, www, () => { if (ServerInfoCached && bQuick) { EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.ServerListUI)); } else { CleanupAllGameData(false); NetManager.Instance.StartCoroutine(LoginLogic.LoginSuccess()); } })); }); }; NetManager.Instance.StartCoroutine(ExitSelectCharacterCoroutine(action)); GVoiceManager.Instance.QuitRoom(true); EraManager.Instance.Clear(); PlayerDataManager.Instance.IsCheckSailingTip = false; }
/// <summary> /// 确定 /// </summary> public void Sure() { try { if (!PhoneHelper.ValidateMobile(UserName)) { SendMsg("register", "userNameError"); return; } if (CheckCode == "") { SendMsg("register", "checkCodeError"); return; } if (Password == "") { SendMsg("register", "passWordError"); return; } LoginLogic loginLogic = new LoginLogic(); ResultModel <Token> result = loginLogic.Register(InterfacePath.Default.Register, CheckCode, UserName, NickName, Password, "", ""); SendMsg("register", result.code.ToString()); Log4Helper.Info(this.GetType(), $"手机号:{UserName},注册:{result.msg}"); } catch (Exception ex) { SendMsg("register", "Error"); Log4Helper.Error(this.GetType(), ex); } }
private async void LoginButton_Clicked(object sender, EventArgs e) { string email = emailEntry.Text; string password = passwordEntry.Text; if (String.IsNullOrEmpty(email) || String.IsNullOrEmpty(password)) { await DisplayAlert("Greška!", "Morate popuniti sva polja", "OK"); return; } else { loginButton.IsEnabled = false; registerButton.IsEnabled = false; loginActivityIndicator.IsVisible = true; bool success = await LoginLogic.Login(email, password); if (success) { Application.Current.MainPage = new MainPage(); } else { await DisplayAlert("Neispravan unos!", "Email ili lozinka nisu ispravni", "OK"); } loginButton.IsEnabled = true; registerButton.IsEnabled = true; loginActivityIndicator.IsVisible = false; } }
public CadastroViewModel() { _usuarioLogic = new UsuarioLogic(); _loginLogic = new LoginLogic(); Init(); }
public async void WillReturnFalseOnIsUserLoggedInAsync() { const string nsId = "some nsid"; const string userName = "******"; const string mockJsonResponse = "{\"user\":{\"id\":\"" + nsId + "\",\"username\":{\"_content\":\"" + userName + "\"}},\"stat\":\"ok\"}"; dynamic deserializedJson = (new JavaScriptSerializer()).Deserialize <dynamic>(mockJsonResponse); var logic = new LoginLogic(_oAuthManager, null, _tokenRepository, _userRepository, _preferencesRepository, _updateRepository); _tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = "Some String", Secret = null }); _userRepository.Expect(t => t.Get()).Return(new User { Name = userName, UserNsId = "some other NsId" }); _oAuthManager.Stub(o => o.MakeAuthenticatedRequestAsync(null, null)) .IgnoreArguments() .Return(Task.FromResult <dynamic>(deserializedJson)); var applyUser = new Action <User>(delegate { }); Assert.IsFalse(await logic.IsUserLoggedInAsync(applyUser)); _tokenRepository.VerifyAllExpectations(); _userRepository.VerifyAllExpectations(); _oAuthManager.VerifyAllExpectations(); }
public async void WillCallTestLoginMethodOnIsUserLoggedInAsync() { var logic = new LoginLogic(_oAuthManager, null, _tokenRepository, _userRepository, _preferencesRepository, _updateRepository); const string tokenString = "Some String"; _tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = tokenString, Secret = null }); _userRepository.Expect(t => t.Get()).Return(new User()); _oAuthManager.Expect(o => o.MakeAuthenticatedRequestAsync(null, null)).IgnoreArguments(); var applyUser = new Action <User>(delegate { }); await logic.IsUserLoggedInAsync(applyUser); _tokenRepository.VerifyAllExpectations(); _userRepository.VerifyAllExpectations(); Assert.Equals(_oAuthManager.AccessToken, tokenString); _oAuthManager.VerifyAllExpectations(); }
public Boolean passwordFormatValidation(string password) { try { LoginLogic loginLogic = new LoginLogic(); return(loginLogic.passwordFormatValidation(password)); } catch (BusinessLogicException ex) { HandleSoapException handleSoapExceptionnew = new HandleSoapException(); SoapException soapException = new SoapException(); soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri, "passwordFormatValidation", ex.Message, AppEnum.FaultSourceWS.BusinessError.ToString(), Constants.faultBusinessError, AppEnum.FaultSourceWS.BusinessError); throw soapException; } catch (Exception ex) { HandleSoapException handleSoapExceptionnew = new HandleSoapException(); SoapException soapException = new SoapException(); soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri, "passwordFormatValidation", ex.Message, AppEnum.FaultSourceWS.AplicationError.ToString(), Constants.faultAplicationError, AppEnum.FaultSourceWS.AplicationError); throw soapException; } }
public ActionResult Login(LoginModel model) { if (!ModelState.IsValid || model.userName != "admin") { return(View()); } using (LoginLogic login = new LoginLogic()) { if (login.IsExist(model.userName, FormsAuthentication.HashPasswordForStoringInConfigFile(model.password, "sha1"))) { //if mailconfirm ok FormsAuthentication.RedirectFromLoginPage(model.userName, model.RememberMe); Session["mailRegistration"] = model.userName; // Login c =login.getLogin(model.userName, FormsAuthentication.HashPasswordForStoringInConfigFile(model.password, "sha1")); // int? familyId = LoginLogic.getFamilyId(model.userName, FormsAuthentication.HashPasswordForStoringInConfigFile(model.password, "sha1")).familyId; //if (familyId.HasValue) // { //redirect to action family} // Session["familyId"] = familyId; // return RedirectToAction("index", "Family"); // } // else // return RedirectToAction("create", "Family"); } else { ViewBag.message = DictExpressionBuilderSystem.Translate("message.IncorectuserNameorPassword"); } //ViewBag.message = "Incorect userName or Password"; } return(View()); }
/// <summary> /// ログインボタンクリックイベント /// 入力されたIDとパスワードが正しければログインする /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { if (CheckInput()) { var loginLogic = new LoginLogic(); //IDとパスワードが一致すればメインメニューを表示 try { if (loginLogic.UserCheck(textBox1.Text, textBox2.Text)) { this.Hide(); new MenuForm(loginLogic.UserInfo, this.Location).Show(); //このフォームが一番最初に呼び出されたフォームでなければ閉じる if (this.IsFirstForm != true) { this.Close(); } } else { MessageBox.Show("IDとパスワードが一致しません。", "お知らせ"); } } catch (NpgsqlException) { MessageBox.Show("ログインに失敗しました。", "お知らせ"); } } textBox1.ResetText(); textBox2.ResetText(); }
public void InitTest() { loginLogic = new LoginLogic(); var client = loginLogic.GetClient(); Assert.IsNotNull(client); }
/// <summary> /// Login user action /// </summary> /// <param name="param"></param> public void LoginUser(object param) { if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Password)) { var logic = new LoginLogic(); IsEnableLogin = false; var status = SingletonLicense.Instance.IsNetworkAvilable; if (status) { status = logic.AuthenticateUser(Email, Password); } else { MessageBox.Show("Network Not available"); return; } if (status) { SingletonLicense.Instance.IsUserLoggedIn = true; NavigateNextPage?.Invoke(null, null); IsEnableLogin = true; } else { MessageBox.Show(logic.ErrorMessage); logic.ErrorMessage = String.Empty; IsEnableLogin = true; } } }
public ActionResult Logoff() { var logoff = new LoginLogic(); logoff.Logout(); return(RedirectToAction("Index")); }
public void WillCallBeginAuthorizationOnOAuthManagerOnLogin() { this._oAuthManager.Expect(o => o.BeginAuthorization()).Return(string.Empty); var logic = new LoginLogic(this._oAuthManager, null, null, null, null, null); logic.Login(null); this._oAuthManager.AssertWasCalled(o => o.BeginAuthorization()); }
public string WsSecurityLoginJson(string dato) { LoginLogic mysqlGet = new LoginLogic(); var datos = mysqlGet.SecurityUserJson(dato); var response = JsonConvert.SerializeObject(datos, Formatting.Indented); return(response); }
public string WsSecurityUser(string mail, string password) { LoginLogic mysqlGet = new LoginLogic(); var datos = mysqlGet.SecurityUserUnics(mail, password); var response = JsonConvert.SerializeObject(datos, Formatting.Indented); return(response); }
public ChapeauModel.Employee loginUI(string username, string password) { LoginLogic logic = new LoginLogic(); ChapeauModel.Employee employee = logic.LoginCheck(username, password); return(employee); }
public void WillCallBeginAuthorizationOnOAuthManagerOnLogin() { _oAuthManager.Expect(o => o.BeginAuthorization()).Return(string.Empty); var logic = new LoginLogic(_oAuthManager, null, null, null, null, null); logic.Login(null); _oAuthManager.AssertWasCalled(o => o.BeginAuthorization()); }
public void LoginUser() { LoginLogic logic = new LoginLogic(); CreateUser(); Assert.IsNotNull(logic.Login("Quinn2500", "@Appel1"), "Kan gebruiker niet inloggen"); Assert.IsNull(logic.Login("Quinn2500", "@Apel1"), "Kan gebruiker inloggen vanwege verkeer wachtwoord"); db.DeleteUser("Quinn2500"); }
public void WillCallDeleteOnAllRepositoriesOnLogout() { var logic = new LoginLogic(null, null, this._tokenRepository, this._userRepository, this._preferencesRepository, this._updateRepository); logic.Logout(); this._tokenRepository.AssertWasCalled(t => t.Delete()); this._userRepository.AssertWasCalled(u => u.Delete()); this._preferencesRepository.AssertWasCalled(u => u.Delete()); this._updateRepository.AssertWasCalled(u => u.Delete()); }
public LoginViewModel() { ServerIP = Framework.Environment.ServerIP; UserName = Framework.Environment.UserName; Password = Framework.Environment.Password; //Password = "******"; RememberPassword = Framework.Environment.SavePassword; m_Logic = new LoginLogic(this); }
public async void WillCallTestLoginMethodOnIsUserLoggedInAsync() { var logic = new LoginLogic(this._oAuthManager, null, this._tokenRepository, this._userRepository, this._preferencesRepository, this._updateRepository); const string tokenString = "Some String"; this._tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = tokenString, Secret = null }); this._userRepository.Expect(t => t.Get()).Return(new User()); this._oAuthManager.Expect(o => o.MakeAuthenticatedRequestAsync(null, null)).IgnoreArguments(); var applyUser = new Action<User>(delegate { }); await logic.IsUserLoggedInAsync(applyUser); this._tokenRepository.VerifyAllExpectations(); this._userRepository.VerifyAllExpectations(); Assert.Equals(this._oAuthManager.AccessToken, tokenString); this._oAuthManager.VerifyAllExpectations(); }
public async void WillReturnFalseWhenTokenRepositoryReturnsEmptyTokenStringOnIsUserLoggedInAsync() { var logic = new LoginLogic(this._oAuthManager, null, this._tokenRepository, this._userRepository, this._preferencesRepository, this._updateRepository); this._tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = null, Secret = null }); this._userRepository.Expect(t => t.Get()).Return(null); var applyUser = new Action<User>(delegate { }); Assert.IsFalse(await logic.IsUserLoggedInAsync(applyUser)); this._tokenRepository.VerifyAllExpectations(); this._userRepository.VerifyAllExpectations(); }
public async void WillReturnFalseOnIsUserLoggedInAsync() { const string nsId = "some nsid"; const string userName = "******"; const string mockJsonResponse = "{\"user\":{\"id\":\"" + nsId + "\",\"username\":{\"_content\":\"" + userName + "\"}},\"stat\":\"ok\"}"; dynamic deserializedJson = (new JavaScriptSerializer()).Deserialize<dynamic>(mockJsonResponse); var logic = new LoginLogic(this._oAuthManager, null, this._tokenRepository, this._userRepository, this._preferencesRepository, this._updateRepository); this._tokenRepository.Expect(t => t.Get()).Return(new Token { TokenString = "Some String", Secret = null }); this._userRepository.Expect(t => t.Get()).Return(new User { Name = userName, UserNsId = "some other NsId" }); this._oAuthManager.Stub(o => o.MakeAuthenticatedRequestAsync(null, null)) .IgnoreArguments() .Return(Task.FromResult<dynamic>(deserializedJson)); var applyUser = new Action<User>(delegate { }); Assert.IsFalse(await logic.IsUserLoggedInAsync(applyUser)); this._tokenRepository.VerifyAllExpectations(); this._userRepository.VerifyAllExpectations(); this._oAuthManager.VerifyAllExpectations(); }