private void UpdateOkButton_Click(object sender, RoutedEventArgs e) { try { bool IsValidPassword = PasswordPolicy.IsValid(txtPassword.Password); if (IsValidPassword && (txtPassword.Password.Trim() == txtConfirmPassword.Password.Trim())) { lblMessageUpdate.Visibility = Visibility.Collapsed; LoginServiceClient _client = new LoginServiceClient(); _client.ChangePasswordCompleted += _client_ChangePasswordCompleted; _client.ChangePasswordAsync(UserNameTextBox.Text.Trim(), txtPassword.Password, LogedInUserSerial); } else { if (txtPassword.Password.Trim() != txtConfirmPassword.Password.Trim()) { lblMessageUpdate.Visibility = Visibility.Visible; lblMessageUpdate.Content = "Passwords not matched"; } else { lblMessageUpdate.Visibility = Visibility.Visible; lblMessageUpdate.Content = "Invalid Password"; } } } catch { } }
public ActionResult Login(UserModels model) { ILoginService loginService = new LoginServiceClient(); try { var result = loginService.Login(model.Login.Trim(), FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password, "SHA1")); var user = loginService.GetUser(new Guid(result)); Session["UserTicket"] = result; Session["UserName"] = user.Name; Session["UserSurname"] = user.Surname; Session["UserId"] = user.Id; Session["UserIsAdmin"] = user.IsAdmin.ToString(); return(Redirect("~/PWrInfo/Index")); } catch (Exception ex) { } ModelState.AddModelError("", "The user name or password provided is incorrect."); return(View(model)); }
private void loginButton_Click(object sender, RoutedEventArgs e) { LoginServiceClient loginClient = new LoginServiceClient("LoginEndpoint"); LoginJson json = new LoginJson { Login = LoginTextBox.Text, Password = PasswordBox.Password }; try { LoginFailedLabel.Visibility = Visibility.Hidden; loginClient.Login(json); var productList = new ProductList(); productList.Show(); Close(); } catch (MessageSecurityException) { LoginFailedLabel.Visibility = Visibility.Visible; } }
public static void GetItemPermissions(string itemName) { var client = new LoginServiceClient(); client.GetItemsPermissionsCompleted += (s, ev) => WFM_UserJobPermissions.SingleOrDefault(x => x.TblPermission == ev.Result); client.GetItemsPermissionsAsync(itemName); }
private void Login() { LoginServiceClient client = null; try { client = new LoginServiceClient(); client.ClientCredentials.UserName.UserName = Username; client.ClientCredentials.UserName.Password = CreateHash(Username, Password); LoginData = client.GetLoginData(); DialogResult = true; } catch (Exception ex) { } finally { if (client != null) { client.Close(); } } }
private void Login() { Task.Factory.StartNew(() => { var client = new LoginServiceClient(new InstanceContext(new NoOpLoginCallback(ToastService))); try { client.Subscribe(); if (!client.IsLoggedIn()) { var remembered = client.GetRememberedUser(); if (!string.IsNullOrEmpty(remembered)) { client.Relogin(); } } } catch (Exception e) { client.Abort(); Thread.Sleep(2000); Login(); } }); }
//Create login public UserData CreateLogin(string pass, UserModel userModel) { using (LoginServiceClient proxy = new LoginServiceClient()) { return(proxy.CreateLogin(pass, UserUtility.ConvertUserModelToUserData(userModel)));//returns userData with pass and salt } }
public LoginChildWindow(LoginMainWindow loginMainWindow) { InitializeComponent(); _loginMain = loginMainWindow; grdUpdatePassword.Visibility = Visibility.Collapsed; pnlName.Text = "Login"; LoginServiceClient _client = new LoginServiceClient(); }
public void SetUpServer(string ip, string port) { connUtil.SetUpServer(ip, port); CloseServices(); loginService = connUtil.createLoginService(); factoryService = connUtil.createFactoryService(); simulationService = connUtil.createSimulationService(); }
static void Main(string[] args) { string factoryID; string [] factories; loginService = ConnectionUtils.getLoginService(); sessionID = testLogin(); factories = getFactories(loginService, sessionID); factoryID = factories[0]; bool connected = connectToFactory(factoryID); registerMQListener(factoryID); Console.WriteLine("Connected to factory: " + connected); loginService.Close(); factoryService = ConnectionUtils.getFactoryService(); factory connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); string itemId1 = createItem(1, 17, 42, FactoryServiceReference.direction.SOUTH); string itemId2 = createItem(89, 0, 0, FactoryServiceReference.direction.NORTH); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); int x = 20; int y = 20; direction dir = direction.WEST; position pos = getPosition(20, 20, direction.WEST); Console.WriteLine("Moving item " + itemId1 + " to " + x + "," + y + ", direction:" + dir); factoryService.moveItem(sessionID, itemId1, pos); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); Console.WriteLine("deleting item " + itemId1); factoryService.deleteItem(sessionID, itemId1); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); Console.WriteLine("Warte auf input"); Console.ReadKey(); }
private string GetDataProxyClient() { LoginServiceClient client = new LoginServiceClient(); string content = client.GetData(); client.Close(); return content; }
public ActionResult Index(Person person) { //new InstanceContext(this) _client = new LoginServiceClient(); if (_client.Login(person.SSN, person.Password)) { Session["SSN"] = person.SSN; return(RedirectToAction("Index", "Home")); } return(View()); }
private void RegistradeEvent(object sender, System.Windows.RoutedEventArgs e) { var username = RegUsernameInput.Text; var password = RegPasswordInput.Text; LoginServiceClient lsc = new LoginServiceClient(); lsc.register(username, password); RegistrationPanel.IsOpen = false; }
public SpotifyWizardPage1() { InitializeComponent(); _deferredLoginTimer = new DispatcherTimer(); _deferredLoginTimer.Interval = TimeSpan.FromMilliseconds(750); _deferredLoginTimer.Tick += DeferredLoginTimerOnTick; _client = new LoginServiceClient(new InstanceContext(this)); LoadingIndicator = new LoadingIndicatorService(); DataContext = this; }
public LoginServiceClient createLoginService() { try { Binding httpBinding = new BasicHttpBinding(); LoginServiceClient service = new LoginServiceClient(httpBinding, getEndpointAddress(LOGIN_ENDING)); return service; } catch (Exception) { return null; } }
public Task DoLogin() { LoginStatus.Status = LoginStatus.EloginStatus.NoLogin; UtilitiesHash utilitiesHash = new UtilitiesHash(); LoginServiceClient login; login = new LoginServiceClient(new NetTcpBinding(SecurityMode.None), new EndpointAddress("net.tcp://" + CurrentPlayer.IPDirection + ":8091/LoginService")); ILoginServiceUsuario usuario = new ILoginServiceUsuario(); usuario.Username = User_InputField.text; usuario.Password = utilitiesHash.PassHash(Password_InputField.text); Debug.Log(usuario.Password); try { switch (login.ValidateUser(usuario)) { case DBOperationResultAddResult.WrongCredentials: LoginStatus.Status = LoginStatus.EloginStatus.WrongCredentials; Debug.Log("en los cases"); break; case DBOperationResultAddResult.ConfirmationIsFalse: LoginStatus.Status = LoginStatus.EloginStatus.NotConfirmed; CurrentPlayer.Email = login.GetEmail(usuario); CurrentPlayer.Username = usuario.Username; Debug.Log(CurrentPlayer.Email); break; case DBOperationResultAddResult.Success: LoginStatus.Status = LoginStatus.EloginStatus.Succces; CurrentPlayer.Username = usuario.Username; break; case DBOperationResultAddResult.SQLError: throw new TimeoutException(); case DBOperationResultAddResult.NullObject: throw new TimeoutException(); } } catch (SocketException) { throw new SocketException(); } catch (TimeoutException) { throw new TimeoutException(); } return(Task.CompletedTask); }
public LoginReference.User us; //用户的所有信息 public RoomWindow(LoginReference.User ustmp) { InitializeComponent(); us = ustmp; item = CC.GetUser(us.Acount); Checkinclient = new CheckinServerClient(new InstanceContext(this)); loginclient = new LoginServiceClient(); if (us.Avart == null) { us.Avart = "boy.png"; } this.photo.Source = new BitmapImage(new Uri("pack://application:,,,/image/" + us.Avart)); Checkinclient.Login(us.Name); }
protected void lnkLogin_Click(object sender, EventArgs e) { LoginServiceClient login = new LoginServiceClient(); BASE_USER user = new BASE_USER(); user = login.Login(email.Value, password.Value); if (user != null) { SetSessions(user); Response.Redirect("Index.aspx"); } else { Response.Redirect("LoginPage.aspx"); } }
private bool IsLoggedIn() { LoginServiceClient client = new LoginServiceClient(new InstanceContext(new NoOpCallbacks())); try { bool result = client.IsLoggedIn(); client.Close(); return(result); } catch { client.Abort(); return(false); } }
public void Run(string userName, string password) { Thread.Sleep(4000); _loginEvent = new ManualResetEventSlim(); var login = new LoginServiceClient(new InstanceContext(this)); login.Subscribe(); login.Login(userName, password, false); Console.WriteLine("Logging in..."); if (!_loginEvent.Wait(10000)) { Console.WriteLine("Unable to login"); return; } var query = new QueryServiceClient(); Console.WriteLine("Searching"); var result = query.Query("NOFX", 0, 10, 0, 10, 0, 10); foreach (var track in result.Tracks) { Console.WriteLine(track.Name); } foreach (var album in result.Albums) { Console.WriteLine(album.Name); } //var control = new PlayerControlServiceClient(new InstanceContext(new MyPlayerControlCallbacks())); //control.Subscribe(); //var player = new PlaylistPlayerServiceClient(); //player.Initialize(new[] // { // "spotify:track:2lvILTIWBbzFeHF95zSWoF", // "spotify:track:50JVjWk5JwoJsIQLcqHftd" // }); //control.SetVolume(0.4f); Console.ReadLine(); }
static string[] getFactories(LoginServiceClient service, long sessionId) { try { Console.WriteLine("Versuche Factories zu laden..."); string[] factories = service.getFactories(sessionId); Console.WriteLine("Factories erhalten: "); foreach (string ele in factories) { Console.WriteLine(" '" + ele + "' "); } return(factories); } catch (FaultException e) { Console.WriteLine("Problem beim Laden der Factory-Liste."); } return(null); }
public void Load() { Task.Factory.StartNew(() => { _loginServiceClient = new LoginServiceClient(new InstanceContext(this)); try { _loginServiceClient.Subscribe(); IsLoggedIn = _loginServiceClient.IsLoggedIn(); UserName = _loginServiceClient.GetRememberedUser(); } catch (Exception) { _loginServiceClient.Abort(); } }); }
public static RoutingServiceClient RoutingServiceClient; // Object to handle the Routing Client Service from the Webservices // Login to RNA Webservice - Needs a Webservice valid user public static string[] Login() { try { // Build Application Information. The ClientApplicationIdentifier GUID is the application ID // for integration users and should not be changed ClientApplicationInfo AppInfo = new ClientApplicationInfo { ClientApplicationIdentifier = new Guid(ConfigurationManager.AppSettings["ClientApplicationIdentifier"]) }; // Call the Web Services LoginServiceClient loginServiceClient = new LoginServiceClient(); LoginResult loginResult = loginServiceClient.Login( ConfigurationManager.AppSettings["Login"], ConfigurationManager.AppSettings["Password"], new CultureOptions(), AppInfo); // Checks if the process returned a valid result if (loginResult == null) { throw new Exception("Login failed."); } else { // Stores the Webservice session header SessionHeader = new SessionHeader { SessionGuid = loginResult.UserSession.Guid }; // Enable the Query Client Service QueryServiceClient = new QueryServiceClient("BasicHttpBinding_IQueryService", loginResult.QueryServiceUrl); string[] r = new string[] { loginResult.User.EntityKey.ToString(), loginResult.User.EmailAddress.ToString() }; return(r); } } catch (Exception Ex) { throw new Exception(Ex.Message); } }
public ActionResult UserProfile(UserModels model) { if (Session["UserTicket"] != null) { if (model.Password == model.repeatPassword) { ILoginService loginService = new LoginServiceClient(); if (loginService.TryLogin(model.Login.Trim(), FormsAuthentication.HashPasswordForStoringInConfigFile(model.oldPassword, "SHA1"))) { model.changePassword(model, new Guid(Session["UserTicket"].ToString())); return(Redirect("~/PWrInfo/Index")); } } ModelState.AddModelError("", "The user old password is incorrect."); return(View(model)); } return(Redirect("~/Login/Login")); }
private void LoginButton_Click(object sender, RoutedEventArgs e) { if (this.UserName.Visibility == Visibility.Collapsed) { this.info.Text = "Please Login"; this.UserName.Visibility = Visibility.Visible; this.LoginButton.Content = "Login"; IsolatedStorageSettings.SiteSettings[WELCOME] = null; } else { string name = this.UserName.Text; if (!String.IsNullOrEmpty(name)) { LoginServiceClient loginService = new LoginServiceClient(); loginService.LoginCompleted += new EventHandler <LoginCompletedEventArgs>(loginService_LoginCompleted); loginService.LoginAsync(name); } } }
/*----------------------------------------------------- 分割线 ----------------------------------------------------------------*/ #region 客户端内的方法 //画板相关+聊天室登录信息显示 private void Window_Loaded(object sender, RoutedEventArgs e) { //初始化两个服务端接口 client = new ServiceClient(new InstanceContext(this)); loginclient = new LoginServiceClient(); //显示登录 client.Login(roomId, us.Name); this.textBoxUserName.Content = us.Name; //初始化墨迹和画板 currentColor = Colors.Red; inkDA = new DrawingAttributes() { Color = currentColor, Height = 6, Width = 6, FitToCurve = false }; inkcanvas.DefaultDrawingAttributes = inkDA; inkcanvas.EditingMode = InkCanvasEditingMode.Ink; }
public LoginServiceClient createLoginService() { Binding httpBinding = new BasicHttpBinding(); LoginServiceClient service = new LoginServiceClient(httpBinding, getEndpointAddress(LOGIN_ENDING)); return service; }
private void RegistradeEvent(object sender, System.Windows.RoutedEventArgs e) { var username = RegUsernameInput.Text; var password = RegPasswordInput.Text; LoginServiceClient lsc = new LoginServiceClient(); lsc.register(username,password); RegistrationPanel.IsOpen = false; }
private bool IsLoggedIn() { LoginServiceClient client = new LoginServiceClient(new InstanceContext(new NoOpCallbacks())); try { bool result = client.IsLoggedIn(); client.Close(); return result; } catch { client.Abort(); return false; } }
static string[] getFactories(LoginServiceClient service, long sessionId) { try { Console.WriteLine("Versuche Factories zu laden..."); string[] factories = service.getFactories(sessionId); Console.WriteLine("Factories erhalten: "); foreach (string ele in factories) { Console.WriteLine(" '" + ele + "' "); } return factories; } catch (FaultException e) { Console.WriteLine("Problem beim Laden der Factory-Liste."); } return null; }
static void Main(string[] args) { string factoryID; string [] factories; loginService = ConnectionUtils.getLoginService(); sessionID = testLogin(); factories = getFactories(loginService, sessionID); factoryID = factories[0]; bool connected = connectToFactory(factoryID); registerMQListener(factoryID); Console.WriteLine("Connected to factory: "+connected); loginService.Close(); factoryService = ConnectionUtils.getFactoryService(); factory connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); string itemId1 = createItem(1, 17, 42, FactoryServiceReference.direction.SOUTH); string itemId2 = createItem(89, 0, 0, FactoryServiceReference.direction.NORTH); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); int x = 20; int y = 20; direction dir = direction.WEST; position pos = getPosition(20, 20, direction.WEST); Console.WriteLine("Moving item " + itemId1 + " to " + x + "," + y + ", direction:" + dir); factoryService.moveItem(sessionID, itemId1, pos); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); Console.WriteLine("deleting item " + itemId1); factoryService.deleteItem(sessionID, itemId1); connectedFactory = factoryService.getFactory(sessionID); printFactory(connectedFactory); Console.WriteLine("Warte auf input"); Console.ReadKey(); }
private void DeferredLoginTimerOnTick(object sender, EventArgs eventArgs) { _deferredLoginTimer.Stop(); try { LoadingIndicator.Push(); if (_client.State != CommunicationState.Opened) { _client = new LoginServiceClient(new InstanceContext(this)); } _client.Subscribe(); _client.Login(_userName.Text, _password.Password, true); } catch (Exception exception) { Console.WriteLine(exception); _client.Abort(); } }