How To Reset Password |
A user may forget their password or want to change it. Use the methods on this page to support that.
Send a GET request to SendPasswordReminder(String):
1var remindPasswordUrl = $"{storedrestURL}UserService/SendPasswordReminder?user={email}"; 2using (WebClient client = new WebClient()) 3{ 4 string s = client.DownloadString(remindPasswordUrl); 5 var simpleResponse = JsonConvert.DeserializeObject<SimpleResponse>(s); 6 7}
{ "errorMessage": "", "success": true, "tokenExists": true, "tokenIsValid": true }
Send a POST to ChangePassword(ChangePassword, String, String):
1var changePasswordUrl = $"{storedrestURL}UserService/ChangePassword?token={savedToken}&device={device}"; 2 3var http = (HttpWebRequest)WebRequest.Create(new Uri(changePasswordUrl)); 4http.Accept = "application/json"; 5http.ContentType = "application/json"; 6http.Method = "POST"; 7 8var postBody = @"{ 9 userId = 311, 10 newPassword = "iAmComPleX$33" 11 12}; 13 14ASCIIEncoding encoding = new ASCIIEncoding(); 15Byte[] bytes = encoding.GetBytes(postBody); 16 17Stream newStream = http.GetRequestStream(); 18newStream.Write(bytes, 0, bytes.Length); 19newStream.Close(); 20 21var response = http.GetResponse(); 22 23var stream = response.GetResponseStream(); 24var sr = new StreamReader(stream); 25var s = sr.ReadToEnd(); 26var response = JsonConvert.DeserializeObject<SimpleResponse>(s);
{ "errorMessage": "", "success": true, "tokenExists": true, "tokenIsValid": true }