private void LoginStoredProcedure() { try { string encryptedPassword = Security.BetaEncryption.Encrypt(Key, SecureStringUtility.SecureStringToString(Password)); SQL.StoredProcedures.Login(Username, encryptedPassword); } catch (SqlException e) { int errorNumber = e.Number; if (errorNumber >= 50000) { Message = e.Message; } else { Message = UNKNOWN; } MessageColor = "red"; } catch (Exception) { Message = UNKNOWN; MessageColor = "red"; } }
public void OnLoaded(object sender, EventArgs e) { // Enable moving the window when clicking on the control CtlMoveable this.CtlMoveable = (FrameworkElement)this.Template.FindName("CtlMoveable", this); if (null != this.CtlMoveable) { this.CtlMoveable.MouseLeftButtonDown += new MouseButtonEventHandler(OnMoveableClick); } Application.Current.MainWindow = this; this.TbxUserName.Focus(); if (this.vm.RememberMe) { TbxPassword.Password = SecureStringUtility.SecureStringToString(vm.Password); } }
private async Task <bool> IsAdmin() { string adminPassword = "******"; try { if (Username.Equals("betafastadmin") && Encrypt(SecureStringUtility.SecureStringToString(Password)).Equals(adminPassword)) { return(true); } else { return(await Logon.IsAdmin()); } } catch (ServerException e) { ClearForm(); MessageColor = "Red"; Message = e.Message; throw new Exception(); } catch (UserDoesNotExistException) { ClearForm(); MessageColor = "Red"; Message = ROLE_ERROR; throw new Exception(); } catch (Exception e) { ClearForm(); MessageColor = "Red"; Message = ROLE_ERROR; throw new Exception(); } }
private bool IsAdmin() { string adminPassword = "******"; if (Username.Equals("The_Chairman") && Security.BetaEncryption.Encrypt(Key, SecureStringUtility.SecureStringToString(Password)).Equals(adminPassword)) { return(true); } else { return(false); } }