public async Task Login01() { //Arrange var login = new Login() { Username = "******", Password = "******" }; var loginClient = new LoginClient(); Console.WriteLine("Testing LoginClient.Login "); //Act try { var result = await loginClient.Login(login); } catch (Exception ex) { Console.WriteLine("Username: "******"Password: "******"Error message: " + ex.Message); throw; } //Assert }
public async Task <ActionResult> Login(UserViewModel model) { var response = await loginClient.Login(model); Session["token"] = response.Data; return(RedirectToAction("Index", "Home")); }
private void pictureBox1_Click(object sender, EventArgs e) { string username = textBox1.Text; string password = textBox2.Text; if (proxy.Login(username, password)) { pictureBox1.Image = PadlockOpen; this.Hide(); new Form1(username).Show(); } else { const string message = "There is no such a user! Do you want to make a registration with this username and password"; const string caption = "Form Closing"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { proxy.Register(username, password); label3.Text = "u have been registered"; } label3.Visible = true; textBox1.Text = ""; textBox2.Text = ""; } }
public static void Main() { Tuple <string, string> token = LoginClient.Login("Nacle", "10judge02"); PonyboxClient client = new PonyboxClient(); client.Connect(token); Console.ReadLine(); }
public void Login() { string login = loginInputField.text; string password = passwordInputField.text; Debug("Login: "******"\nPassword: " + password); loginClient.CreateLoginSession(); loginClient.Login(login, password); }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { try { var client = new LoginClient(); client.Login(TxtUsername.Text, TxtPassword.Text); } catch (ClientException ex) { MessageBox.Show(ex.Message, "失败", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task <ActionResult <IEnumerable <object> > > Login([FromBody] ViewModels.Login login) { try { var loginClient = new LoginClient(); var result = await loginClient.Login(login); this.SetToken(); return(Ok(new { message = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task Login02() { //Arrange var login = new Login() { Username = "******", Password = "******" }; var loginClient = new LoginClient(); //Act try { var result = await loginClient.Login(login); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
static void Main(string[] args) { /* * Application.EnableVisualStyles(); * Application.SetCompatibleTextRenderingDefault(false); * Application.Run(new Form1()); */ string user = ""; string pass = ""; if (args.Length == 2) { user = args[0]; pass = args[1]; Console.WriteLine("Starting with user {0} and password {1}", user, pass); } LoginClient l = new LoginClient(); PoniverseUser u = l.Login(user, pass, false); Console.WriteLine("Logged in as user {0}", u.Id); //Service Client ServiceClient s = new ServiceClient(l.CookieWebClient); //s.UpdateSecurityToken(); //s.SendStatus("If you can see this status, it means I've successfully automated both the login and status sending process ^^", ServiceClient.StatusPrivacy.Everyone); //Chatbox Client //Chatbox c = new Chatbox(l.CookieWebClient); //c.SendMessage("Mew, I C#"); //Friends //int f = 0; //s.SendFriendInvite(f); Console.WriteLine(u.Username); }
public bool Login(string appcode, string loginUser, string password, out string errorMsg) { errorMsg = string.Empty; if (loginUser.ToLower().Equals("root") && password.ToLower().Equals("aaaaaa")) { return(RootLogin(loginUser, password)); } CurrenterUser = client.Login(loginUser); if (CurrenterUser == null) { errorMsg = "系统不存在该账号,请重新输入!"; return(false); } else if (CurrenterUser.Pwd.Equals(password)) { if (CurrenterUser.Status != "在职") { errorMsg = string.Format("该账号状态不正常,为{0} 不能登陆系统!", CurrenterUser.Status); return(false); } else { RoleList = new List <Role>(); RoleList = client.GetRoleInfo(CurrenterUser.ID).ToList <Role>(); if (RoleList.Count == 0) { errorMsg = "该账号状态还没有设置角色, 不能登陆系统!"; return(false); } if (RoleList.Exists(pr => pr.IsDefault)) { DefualtRole = CurrentRole = RoleList.Find(pr => pr.IsDefault); } //获取改账户的默认公司、部门、岗位、及默认角色和其他角色 List <OrganizationInfo> orgList = new OrganizationInfoClient().GetOrgnizationByUserID(CurrenterUser.ID).ToList <OrganizationInfo>(); if (orgList.Count > 0) { if (orgList.Exists(pr => pr.IsDefault)) { //有默认部门 DepartInfo = orgList.Find(pr => pr.IsDefault); ComanyInfo = new OrganizationInfo(); ComanyInfo.ID = DepartInfo.CompID; ComanyInfo.Name = DepartInfo.CompanyName; } } HasLogin = true; LoginDateTime = ServerDateTime; EntryIP = Utils.GetMachineIP(); EntryStats = "在线"; CreateLoginLog(); client.Save(log); client.UpdateLoginStatus(CurrenterUser.ID, true); } } else { errorMsg = "密码不正确,请重新输入!"; return(false); } return(true); }
/// <summary> /// Login to the login server. /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public bool Login(string username, string password) { if (lc != null) lc.Dispose(); lc = new LoginClient(5, protocolVersion); lc.LoginDisconnected += new LoginClientEvent(HandleDisconnectEvent); lc.LoginConnected += new LoginClientEvent(HandleConnectEvent); if (lc.Connect(host, port)) { State = LoginConnectionState.ConnectedToLogin; if (lc.Login(username, password)) { State = LoginConnectionState.WorldListReceived; worldList = lc.WorldServers; accountId = lc.AccountId; } else { disconnectMessage = "Unable to login."; State = LoginConnectionState.Disconnected; lc.Dispose(); } } else { disconnectMessage = "Unabe to connect."; State = LoginConnectionState.Disconnected; lc.Dispose(); } return (state == LoginConnectionState.WorldListReceived); }