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(); } } }
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.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 async void SignInPassport() { if ((ViewModel as LoginViewModel).PassportEnabled) { if (await MicrosoftPassportHelper.CreatePassportKeyAsync()) { shell?.SetLoggedInView(); (ViewModel as LoginViewModel)?.LoginNavigationCommand.Execute(); } } else { PassportLogin.Visibility = Visibility.Collapsed; } }
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!"; } } }
/// <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 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"; } }
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 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"; } }
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 = ""; //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)) { if (PasswordTextBox.ToString().Equals(PasswordConfirmTextBox.ToString())) { //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 { MessageDialog showDialog = new MessageDialog("You have mistyped your password"); showDialog.Commands.Add(new UICommand("Okay") { Id = 0 }); showDialog.DefaultCommandIndex = 0; var result = await showDialog.ShowAsync(); } } else { ErrorMessage.Text = "Please enter a username"; } }