Advertisement
Guest User

Untitled

a guest
Dec 28th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. private async Task btnSave_Clicked(object sender, EventArgs e)
  2. {
  3. if (entNewPass.Text == null || entNewPass.Text == "")
  4. {
  5. DisplayAlert("Notice", "Please enter your new password", "OK");
  6. }
  7. else
  8. {
  9. if(entNewPass.Text.Length <8)
  10. {
  11. DisplayAlert("Notice", "Password must consist atleast 8 characters", "OK");
  12. }
  13. else
  14. {
  15. if (entNewPass.Text == entCNewPass.Text)
  16. {
  17. Users userz = new Users()
  18. {
  19.  
  20. mem_acc_username = currentusername,
  21. mem_acc_password = entNewPass.Text
  22.  
  23.  
  24. };
  25.  
  26.  
  27.  
  28. var json = JsonConvert.SerializeObject(userz);
  29.  
  30.  
  31.  
  32. var content = new StringContent(json, Encoding.UTF8, "application/json");
  33.  
  34.  
  35. HttpClient client = new HttpClient();
  36.  
  37. var result = await client.PostAsync("http://ipoladroid01-001-site1.btempurl.com/Restserver/index.php/users/forgot_password", content);
  38.  
  39.  
  40.  
  41.  
  42. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  43. {
  44. await DisplayAlert("Success :", "Password Changed", "OK");
  45. Navigation.PopAsync();
  46. Navigation.PopAsync();
  47. Navigation.PopAsync();
  48.  
  49. }
  50. else
  51. {
  52. await DisplayAlert("Failed", json, "OK");
  53.  
  54.  
  55. }
  56. }
  57. else
  58. {
  59. DisplayAlert("Notice", "Password confirmation is not match", "OK");
  60. }
  61. }
  62.  
  63. }
  64.  
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement