/// <summary> /// Login user with username and password /// </summary> /// <returns>Error strings, null if OK</returns> public string[] Login(LoginBinder binder) { string[] result; using (var client = CreateWebClient()) { try { client.UploadString(Uri + "/Login", JsonConvert.SerializeObject(binder)); HandleCookies(client.ResponseHeaders); result = null; } catch (WebException e) { ErrorResponse errResp = ErrorResponse.Handle(e); if (errResp != null) { result = errResp.Errors.ToArray(); } else { result = new string[] { "Login failed" }; } } } return(result); }
public LoginView(App app) { this.app = app; LoadPackage(); LoginBinder.BindAll(); view = UI_LoginView.CreateInstance(); Init(view); }
protected internal override void OnInit() { base.OnInit(); LoginBinder.BindAll(); //赋值组件到逻辑实施中 GComponent = Login.CreateInstance(); }
private async void loginBtn_Click(object sender, RoutedEventArgs e) { LoginBinder loginBinder = new LoginBinder() { Username = usernameTextBox.Text, Password = passwordTextBox.Password, }; string[] errors = userManager.Login(loginBinder); if (errors.Length == 0) { //Login successful } else { //Login Failed } }