diff --git a/Gotrue/StatelessClient.cs b/Gotrue/StatelessClient.cs index 3a24fd6..d68d25f 100644 --- a/Gotrue/StatelessClient.cs +++ b/Gotrue/StatelessClient.cs @@ -233,6 +233,26 @@ public static async Task InviteUserByEmail(string email, string jwt, State } } + /// + /// Sends a reset request to an email address. + /// + /// + /// + /// + public static async Task ResetPasswordForEmail(string email, StatelessClientOptions options) + { + try + { + var result = await GetApi(options).ResetPasswordForEmail(email); + result.ResponseMessage.EnsureSuccessStatusCode(); + return true; + } + catch (RequestException ex) + { + throw ExceptionHandler.Parse(ex); + } + } + /// /// Deletes a User. /// diff --git a/GotrueTests/Client.cs b/GotrueTests/Client.cs index 57ab6af..00dbb98 100644 --- a/GotrueTests/Client.cs +++ b/GotrueTests/Client.cs @@ -265,8 +265,8 @@ public async Task ClientDeletesUser() var result = await client.DeleteUser(uid, service_role_key); Assert.IsTrue(result); - } - + } + [TestMethod("Client: Sends Reset Password Email")] public async Task ClientSendsResetPasswordForEmail() { diff --git a/GotrueTests/StatelessClient.cs b/GotrueTests/StatelessClient.cs index 94ed87c..de456f2 100644 --- a/GotrueTests/StatelessClient.cs +++ b/GotrueTests/StatelessClient.cs @@ -15,8 +15,6 @@ namespace GotrueTests [TestClass] public class StatelessClient { - private Client client; - private string password = "I@M@SuperP@ssWord"; private static Random random = new Random(); @@ -221,5 +219,14 @@ public async Task DeletesUser() Assert.IsTrue(result); } + + [TestMethod("StatelessClient: Sends Reset Password Email")] + public async Task ClientSendsResetPasswordForEmail() + { + var email = $"{RandomString(12)}@supabase.io"; + await SignUp(email, password, options); + var result = await ResetPasswordForEmail(email, options); + Assert.IsTrue(result); + } } }