public async Task <Auth0TicketResponse> getPasswordChangeTicketByAuthClientEmail(string authClientEmail) { RestClient roleRestClient = new RestClient(endpoint + "tickets/password-change"); RestRequest roleRequest = new RestRequest(Method.POST); Auth0TokenModel token = await getTokenModel(); roleRequest.AddHeader("authorization", "Bearer " + token.access_token); roleRequest.AddJsonBody(new Auth0ChangePasswordModel() { email = authClientEmail, connection_id = ConfigRoot["Auth0API:ConnectionID"], mark_email_as_verified = true, includeEmailInRedirect = true }); IRestResponse response = await roleRestClient.ExecuteAsync(roleRequest); Auth0TicketResponse ticket = JsonConvert.DeserializeObject <Auth0TicketResponse>(response.Content); return(ticket); }
public async Task sendPasswordResetEmail(string recipientEmail, string recipientNickname, Auth0TicketResponse ticket, bool isNewUser) { SendGridClient client = new SendGridClient(getKey().key); EmailAddress from = new EmailAddress(appEmail, "SantaPone Central"); string subject = "SantaPone Central Login Information"; EmailAddress to = new EmailAddress(recipientEmail, recipientNickname); string plainTextContent = string.Empty; string htmlContent = string.Empty; if (isNewUser) { plainTextContent = "Agent, it's time to bring the cheer, and you've been approved for the cause! Follow the link here to set your password: "******"\nOnce you have it set, login at " + url; htmlContent = emailStart + @$ " <p>Agent, it's time to bring the cheer, and you've been approved for the cause! Follow the link here to set your password: <a href='{ticket.ticket}'>Set your password</a></p> <br> <p>Once you've done that, log into your account at <a href='{url}'>SantaPone Central</a></p>