public async void ConfirmToken(string theSenttoken) { try { EmailTokenDataPayLoad tokenDetail = new EmailTokenDataPayLoad { email = email, ipAddress = ipAddress, sentToken = theSenttoken }; ResponseMessage response = await service.ConfirmTokenControllerService(tokenDetail); if (response.ResponseStatusCode == System.Net.HttpStatusCode.NotFound) { MessageDialog md = new MessageDialog("Token Does Not Exist or Expired", "Invalid Token"); await md.ShowAsync(); } else if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found) { //txtEmail.Text = ""; hideStackPanels(); stackNewPassword.Visibility = Visibility.Visible; MessageDialog md = new MessageDialog("Enter new Password", "Confirmed!"); await md.ShowAsync(); } } catch (Exception ex) { checkInternet(); } }
private async void EmailToken(string StaffEmail) { try { var icp = NetworkInformation.GetInternetConnectionProfile(); if (icp.NetworkAdapter != null) { var hostname = NetworkInformation.GetHostNames().SingleOrDefault(hn => hn.IPInformation?.NetworkAdapter != null && hn.IPInformation.NetworkAdapter.NetworkAdapterId == icp.NetworkAdapter.NetworkAdapterId); ipAddress = hostname.ToString(); EmailTokenDataPayLoad tokenDetail = new EmailTokenDataPayLoad { email = StaffEmail, ipAddress = ipAddress }; ResponseMessage response = await service.StaffForgotPasswordTokenControllerTokenService(tokenDetail); if (response.ResponseStatusCode == System.Net.HttpStatusCode.NotFound) { MessageDialog md = new MessageDialog("You are not registered on Visitors Manager", "Email not Found"); await md.ShowAsync(); } else if (response.ResponseStatusCode == System.Net.HttpStatusCode.Found) { //txtEmail.Text = ""; hideStackPanels(); stackSentToken.Visibility = Visibility.Visible; MessageDialog md = new MessageDialog("Token Sent to Email (" + email + ")", "Check your email"); await md.ShowAsync(); } } else { checkInternet(); } } catch (Exception ex) { // checkInternet(); } }