private void Button_Forget_User_Click(object sender, RoutedEventArgs e) { MicrosoftPassportHelper.RemovePassportAccountAsync(_activeAccount); Debug.WriteLine("User " + _activeAccount.Username + " deleted."); Frame.Navigate(typeof(UserSelection)); }
/// <summary> /// Function called when this frame is navigated to. /// Checks to see if Microsoft Passport is available and if an account was passed in. /// If an account was passed in set the "_isExistingAccount" flag to true and set the _account /// </summary> protected override async void OnNavigatedTo(NavigationEventArgs e) { // Check Microsoft Passport is setup and available on this machine if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { //how the f**k wont e.Parameter be null if (e.Parameter != null) { _AmIForeign = true; // Set the account to the existing account being passed in _account = (Account)e.Parameter; UsernameTextBox.Text = _account.Username; SignInPassport(); } //end up doing nothing } else { // Microsoft Passport is not setup so inform the user PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207)); PassportStatusText.Text = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it."; PassportSignInButton.IsEnabled = false; } }
public MainViewModel() { PassportSignInCommand = new RelayCommand(() => { ErrorMessageText = ""; SignInPassport(); }); NavigatedToCommand = new RelayCommand(async() => { // Check Microsoft Passport is setup and available on this machine if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { } else { // Microsoft Passport is not setup so inform the user PassportStatusBackground = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207)); PassportStatusText = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it."; IsPassportSignInEnabled = false; } }); RegisterPointerPressedCommand = new RelayCommand <object>((param) => { ErrorMessageText = ""; }); }
private async void SignInPassport() { if (_isExistingAccount) { if (await MicrosoftPassportHelper.GetPassportAuthenticationMessageAsync(_account)) { Frame.Navigate(typeof(Welcome), _account); } } else if (AccountHelper.ValidateAccountCredentials(UsernameTextBox.Text)) { //Create and add a new local account _account = AccountHelper.AddAccount(UsernameTextBox.Text); Debug.WriteLine("Successfully signed in with traditional credentials and created local account instance!"); if (await MicrosoftPassportHelper.CreatePassportKeyAsync(UsernameTextBox.Text)) { Debug.WriteLine("Successfully signed in with Microsoft Passport!"); Frame.Navigate(typeof(Welcome), _account); } } else { ErrorMessage.Text = "Invalid Credentials"; } }
private async void SignInPassport() { if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { if (await MicrosoftPassportHelper.CreatePassportKeyAsync(thisuser.UserName)) { var _account = AccountHelper.AddAccount(thisuser.UserName); var dialog = new ContentDialog { Title = "Notice", Content = "You have successfully added this list", IsPrimaryButtonEnabled = true, PrimaryButtonText = "OK", }; await dialog.ShowAsync(); } } else { var dialog = new ContentDialog { Title = "Notice", Content = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it.", IsPrimaryButtonEnabled = true, PrimaryButtonText = "OK", }; await dialog.ShowAsync(); } }
private async void MainPage_Loaded(object sender, RoutedEventArgs e) { bool IsIt = await Library.IsFileEmpty(); if (IsIt) { Frame.Navigate(typeof(FirstTime)); } else { string EncPass = await Library.ReadPassFromFile(); if (await MicrosoftPassportHelper.CreatePassportKeyAsync("User")) { string MyPass = await Library.Decrypt(EncPass); DataPackage MyPassData = new DataPackage(); MyPassData.SetText(MyPass); Clipboard.SetContent(MyPassData); Application.Current.Exit(); } else { ErrorMessage.Text = "Click Here to Set New Password"; //Application.Current.Exit(); } } }
protected override async void OnContentRendered(EventArgs e) { // Check Microsoft Passport is setup and available on this machine if (_useWindowsHello && await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { PasswordTextBox.Visibility = System.Windows.Visibility.Collapsed; } }
private void Button_Forget_User_Click(object sender, RoutedEventArgs e) { // Remove it from Microsoft Passport MicrosoftPassportHelper.RemovePassportAccountAsync(_activeAccount); // Remove it from the local accounts list and resave the updated list AccountHelper.RemoveAccount(_activeAccount); Debug.WriteLine("User " + _activeAccount.Username + " deleted."); }
/// <summary> /// Update Passport /// </summary> public async void UpdatePassport() { if (await MicrosoftPassportHelper.TestPassportAvailable()) { } else { PassportSwitch.IsEnabled = false; PassportStatus.Text = Strings.PassportErrorMessage; } }
public async void UpdatePassport() { if (await MicrosoftPassportHelper.testPassportAvailable()) { } else { PassportSwitch.IsEnabled = false; PassportStatus.Text = " Mircrosoft Passport is not enabled on this device.\nPlease go to settings and enable it!"; } }
private async void SignInPassport() { if (await MicrosoftPassportHelper.CreatePassportKeyAsync()) { appShell?.SetLoggedInView(); (ViewModel as LoginViewModel)?.LoginNavigationCommand.Execute(); } else { PassportStatus.Text = "Microsoft Passport is not enabled.\nPlease go to settings\n to enable passport"; } }
private void Button_Forget_User_Click(object sender, RoutedEventArgs e) { // Remove it from Microsoft Passport MicrosoftPassportHelper.RemovePassportAccountAsync(_activeAccount); // Remove it from the local accounts list and resave the updated list AccountHelper.RemoveAccount(_activeAccount); Debug.WriteLine("User " + _activeAccount.Username + " deleted."); // Navigate back to UserSelection page. (changed it to login page) Frame.Navigate(typeof(Login)); }
/// <summary> /// Update Passport /// </summary> private async Task UpdatePassport() { if (await MicrosoftPassportHelper.TestPassportAvailable()) { PassportSwitch.IsEnabled = true; PassportStatus.Text = string.Empty; } else { PassportSwitch.IsEnabled = false; PassportStatus.Text = Strings.PassportErrorMessage; } }
/// <summary> /// Update Passport /// </summary> public async void UpdatePassport() { if (await MicrosoftPassportHelper.TestPassportAvailable().ConfigureAwait(true)) { PassportSwitch.IsEnabled = true; PassportStatus.Text = string.Empty; } else { PassportSwitch.IsEnabled = false; PassportStatus.Text = Strings.PassportErrorMessage; } }
private void Button_Forget_User_Click(object sender, RoutedEventArgs e) { // Remove it from Microsoft Passport MicrosoftPassportHelper.RemovePassportAccountAsync(_activeAccount); // Remove it from the local accounts list and resave the updated list AccountHelper.RemoveAccount(_activeAccount); //Remove the user from the App App.account = null; // Navigate back to UserSelection page. Frame.Navigate(typeof(fAccount)); }
private async void SignInPassport() { if ((ViewModel as LoginViewModel).PassportEnabled) { if (await MicrosoftPassportHelper.CreatePassportKeyAsync()) { shell?.SetLoggedInView(); (ViewModel as LoginViewModel)?.LoginNavigationCommand.Execute(); } } else { PassportLogin.Visibility = Visibility.Collapsed; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { // Check Microsoft Passport is setup and available on this machine if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { } else { // Microsoft Passport is not setup so inform the user PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207)); PassportStatusText.Text = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it."; PassportSignInButton.IsEnabled = false; } }
//protected override async void OnNavigatedTo(NavigationEventArgs e) //{ //// Check Microsoft Passport is setup and available on this machine // if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) // { // if (e.Parameter != null) // { // _isExistingAccount = true; // Set the account to the existing account being passed in // _account = (Account)e.Parameter; // UsernameTextBox.Text = _account.Username; // SignInPassport(); // } // } // else // { //// Microsoft Passport is not setup so inform the user // PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207)); // PassportStatusText.Text = "Microsoft Passport is not setup!\n" + // "Por favor vaya a la configuración de Windows y y establezca un PIN.\n" + // "Please go to Windows Settings and set up a PIN to use it."; // PassportSignInButton.IsEnabled = false; // } //} protected override async void OnNavigatedTo(NavigationEventArgs e) { //Check Microsoft Passport is setup and available on this machine if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { if (e.Parameter != null) { _isExistingAccount = true; //Set the account to the existing account being passed in _account = (UserAccount)e.Parameter; UsernameTextBox.Text = _account.Username; //SignInPassport(); SignInPassportAsync(); } } }
private async void SignInPassport() { PassportSignInButton.IsEnabled = false; ErrorMessage.Text = "Validating..."; var username = UsernameTextBox.Text; if (AccountHelper.ValidateAccountCredentials(username)) { List <Account> accounts = await AccountHelper.LoadAccountListAsync(); int accountIndex = -1; for (var i = 0; i < accounts.Count; i++) { var account = accounts[i]; if (account.Username == username) { accountIndex = i; break; } } if (accountIndex == -1) { _account = AccountHelper.AddAccount(username); Debug.WriteLine("Successfully signed in with traditional credentials and created local account instance!"); } else { _account = accounts[accountIndex]; } if (await MicrosoftPassportHelper.CreatePassportKeyAsync(_account.Username)) { Debug.WriteLine("Successfully signed in with Microsoft Passport!"); (DataContext as ViewModels.LoginViewModel).DoLogin(); } ErrorMessage.Text = ""; } else { ErrorMessage.Text = "Invalid Credentials"; } PassportSignInButton.IsEnabled = true; }
private async void PassportSignInButton_Click(object sender, RoutedEventArgs e) { if (PassTextBox.Text == "") { ErrorMessage.Text = "Enter the password first"; } else { //Library MyLib = new Library(); string EncPass = await Library.Encrypt(PassTextBox.Text); if (await MicrosoftPassportHelper.CreatePassportKeyAsync("User")) { Library.SavePassToFile(EncPass); ErrorMessage.Text = "Successfully saved!"; } } }
private async void SignInPassport() { if (AccountHelper.ValidateAccountCredentials(UsernameTextBox.Text)) { // Create and add a new local account _account = AccountHelper.AddAccount(UsernameTextBox.Text); if (await MicrosoftPassportHelper.CreatePassportKeyAsync(UsernameTextBox.Text)) { _account.isUserLoggedIn = true; App.account = _account; this.Frame.Navigate(typeof(Frames.fHome)); } } else { ErrorMessage.Text = "Invalid Credentials"; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { if (e.Parameter != null) { _isExistingLocalAccount = true; ///_account = (Account)e.Parameter; _account = (UserAccount)e.Parameter; UsernameTextBox.Text = _account.Username; SignInPassportAsync(); } } else { PassportStatus.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 50, 170, 207)); PassportStatusText.Text = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it."; PassportSignInButton.IsEnabled = false; } }
/// <summary> /// Try to sign in to Microsoft Passport for authentication /// </summary> private async void SignInPassport() { if (AccountHelper.ValidateAccountCredentials(UsernameText)) { // Create and add a new local account userModel = AccountHelper.AddAccount(UsernameText); Debug.WriteLine("Successfully signed in with traditional credentials and created local account instance!"); if (await MicrosoftPassportHelper.CreatePassportKeyAsync(UsernameText)) { Debug.WriteLine("Successfully signed in with Microsoft Passport!"); // Since we go into here for the time being, lets navigate to the Map page NavigationService.Navigate(typeof(MapViewPage)); } } else { ErrorMessageText = "Invalid Credentials"; } }
private void Button_Forget_Device_Click(object sender, RoutedEventArgs e) { PassportDevice selectedDevice = UserListView.SelectedItem as PassportDevice; if (selectedDevice != null) { //Remove it from Windows Hello MicrosoftPassportHelper.RemovePassportDevice(_activeAccount, selectedDevice.DeviceId); Debug.WriteLine("User " + _activeAccount.Username + " deleted."); if (!UserListView.Items.Any()) { //Navigate back to UserSelection page. Frame.Navigate(typeof(UserSelection)); } } else { ForgetDeviceErrorTextBlock.Visibility = Visibility.Visible; } }
private async void SignInPassport() { if (_isExistingAccount) { if (await MicrosoftPassportHelper.GetPassportAuthenticationMessageAsync(_account)) { Frame.Navigate(typeof(Welcome), _account); } } else if (AuthService.AuthService.Instance.ValidateCredentials(UsernameTextBox.Text, PasswordBox.Password)) { Guid userId = AuthService.AuthService.Instance.GetUserId(UsernameTextBox.Text); if (userId != Guid.Empty) { //Now that the account exists on server try and create the necessary passport details and add them to the account bool isSuccessful = await MicrosoftPassportHelper.CreatePassportKeyAsync(userId, UsernameTextBox.Text); if (isSuccessful) { Debug.WriteLine("Successfully signed in with Windows Hello!"); //Navigate to the Welcome Screen. _account = AuthService.AuthService.Instance.GetUserAccount(userId); Frame.Navigate(typeof(Welcome), _account); } else { //The passport account creation failed. //Remove the account from the server as passport details were not configured AuthService.AuthService.Instance.PassportRemoveUser(userId); ErrorMessage.Text = "Account Creation Failed"; } } } else { ErrorMessage.Text = "Invalid Credentials"; } }
private async void FuckingRegisterMate() { if (!(UsernameTextBox.Text.Length > 0)) { ErrorMessage.Text = "Dude...."; return; } bool userNameExistsInFile = await AccountHelper.IsInFuckingFile(UsernameTextBox.Text); if (_AmIForeign) { //Pinsly if (await MicrosoftPassportHelper.GetPassportAuthenticationMessageAsync(_account)) { Frame.Navigate(typeof(Welcome), _account); } } else if (!userNameExistsInFile) { //Register new account with Microsoft Passport var amilegit = await MicrosoftPassportHelper.CreatePassportKeyAsync(UsernameTextBox.Text); if (amilegit) { //Register a new account _account = AccountHelper.AddAccount(UsernameTextBox.Text); //Navigate to the Welcome Screen. Frame.Navigate(typeof(Welcome), _account); } else { ErrorMessage.Text = "Error Signing in"; } } else { ErrorMessage.Text = "Yo dawg, u in already"; } }
private async void RegisterButton_Click_Async(object sender, RoutedEventArgs e) { ErrorMessage.Text = ""; //In the real world you would normally validate the entered credentials and information before //allowing a user to register a new account. //For this sample though we will skip that step and just register an account if username is not null. if (!string.IsNullOrEmpty(UsernameTextBox.Text)) { //Register a new account _account = AccountHelper.AddAccount(UsernameTextBox.Text); //Register new account with Microsoft Passport await MicrosoftPassportHelper.CreatePassportKeyAsync(_account.Username); //Navigate to the Welcome Screen. Frame.Navigate(typeof(Welcome), _account); } else { ErrorMessage.Text = "Please enter a username"; } }
private async void SignInPassportAsync() { if (_isExistingLocalAccount) { if (await MicrosoftPassportHelper.GetPassportAuthenticationMessageAsync(_account)) { Frame.Navigate(typeof(Welcome), _account); //Frame.Navigate(typeof(Menu), _account); } } else if (AuthService.AuthService.Instance.ValidateCredentials(UsernameTextBox.Text, PasswordBox.Password)) { Guid userId = AuthService.AuthService.Instance.GetUserId(UsernameTextBox.Text); if (userId != Guid.Empty) { bool isSuccessful = await MicrosoftPassportHelper.CreatePassportKeyAsync(userId, UsernameTextBox.Text); if (isSuccessful) { Debug.WriteLine("Successfully signed in with Windows Hello!"); _account = AuthService.AuthService.Instance.GetUserAccount(userId); Frame.Navigate(typeof(Welcome), _account); } else { AuthService.AuthService.Instance.PassportRemoveUser(userId); ErrorMessage.Text = "Account Creation Failed"; } } } else { ErrorMessage.Text = "Invalid Credentials"; } }
private async void DeviceLoginButton_Click(object sender, RoutedEventArgs e) { // Check Microsoft Passport is setup and available on this machine if (await MicrosoftPassportHelper.MicrosoftPassportAvailableCheckAsync()) { if (await MicrosoftPassportHelper.CreatePassportKeyAsync("yao")) { Frame.Navigate(typeof(ServicePage), new userItem("firends")); } } else { var dialog = new ContentDialog { Title = "Notice", Content = "Microsoft Passport is not setup!\n" + "Please go to Windows Settings and set up a PIN to use it.", IsPrimaryButtonEnabled = true, PrimaryButtonText = "OK", }; await dialog.ShowAsync(); } }
private async void RegisterButton_Click_Async(object sender, RoutedEventArgs e) { ErrorMessage.Text = ""; //Validate entered credentials are acceptable if (!string.IsNullOrEmpty(UsernameTextBox.Text)) { //Register an Account on the AuthService so that we can get back a userId AuthService.AuthService.Instance.Register(UsernameTextBox.Text); Guid userId = AuthService.AuthService.Instance.GetUserId(UsernameTextBox.Text); if (userId != Guid.Empty) { //Now that the account exists on server try and create the necessary passport details and add them to the account bool isSuccessful = await MicrosoftPassportHelper.CreatePassportKeyAsync(userId, UsernameTextBox.Text); if (isSuccessful) { //Navigate to the Welcome Screen. Frame.Navigate(typeof(Welcome), AuthService.AuthService.Instance.GetUserAccount(userId)); } else { //The passport account creation failed. //Remove the account from the server as passport details were not configured AuthService.AuthService.Instance.PassportRemoveUser(userId); ErrorMessage.Text = "Account Creation Failed"; } } } else { ErrorMessage.Text = "Please enter a username"; } }