feat: add working privacy policy contact form
This commit is contained in:
parent
5283985026
commit
3076f58485
@ -31,6 +31,33 @@ public class ContactController : Controller
|
|||||||
return RedirectToPage("/Contact/Index");
|
return RedirectToPage("/Contact/Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("privacy-policy")]
|
||||||
|
public async Task<IActionResult> HandlePrivacyPolicy()
|
||||||
|
{
|
||||||
|
if (!Request.HasFormContentType)
|
||||||
|
{
|
||||||
|
return RedirectToPage("/Contact/Privacy");
|
||||||
|
}
|
||||||
|
|
||||||
|
IFormCollection form = Request.Form;
|
||||||
|
StringValues name = form["name"];
|
||||||
|
StringValues email = form["email"];
|
||||||
|
StringValues subject = form["subject"];
|
||||||
|
StringValues message = form["message"];
|
||||||
|
StringValues privacyPolicy = form["privacy-policy"];
|
||||||
|
|
||||||
|
await using SmtpSender sender = CreateSender();
|
||||||
|
await sender.WriteEmail
|
||||||
|
.To("Oliver Booth", _destination.GetValue<string>("PrivacyPolicy"))
|
||||||
|
.From(name, email)
|
||||||
|
.Subject($"[{privacyPolicy}] {subject}")
|
||||||
|
.BodyHtml(message)
|
||||||
|
.SendAsync();
|
||||||
|
|
||||||
|
TempData["Success"] = true;
|
||||||
|
return RedirectToPage("/Contact/Result");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("other")]
|
[HttpPost("other")]
|
||||||
public async Task<IActionResult> HandleMiscellaneous()
|
public async Task<IActionResult> HandleMiscellaneous()
|
||||||
{
|
{
|
||||||
|
@ -18,21 +18,21 @@
|
|||||||
Please outline your concerns in the form below, and I will get back to you as soon as possible.
|
Please outline your concerns in the form below, and I will get back to you as soon as possible.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post" asp-controller="Contact" asp-action="HandlePrivacyPolicy">
|
||||||
<input type="hidden" name="contact-type" value="privacy-policy">
|
<input type="hidden" name="contact-type" value="privacy-policy">
|
||||||
|
|
||||||
<div class="form-group" style="margin-top: 10px;">
|
<div class="form-group" style="margin-top: 10px;">
|
||||||
<label for="your-name">Your Name</label>
|
<label for="name">Your Name</label>
|
||||||
<input type="text" class="form-control" id="your-name" name="your-name" placeholder="Who are you?">
|
<input type="text" class="form-control" id="name" name="name" placeholder="Who are you?">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="margin-top: 10px;">
|
<div class="form-group" style="margin-top: 10px;">
|
||||||
<label for="your-email">Your Email Address</label>
|
<label for="email">Your Email Address</label>
|
||||||
<input type="email" class="form-control" id="your-email" name="your-email" placeholder="How can I reach you?">
|
<input type="email" class="form-control" id="email" name="email" placeholder="How can I reach you?">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="margin-top: 10px;">
|
<div class="form-group" style="margin-top: 10px;">
|
||||||
<label for="your-email">Privacy Policy</label>
|
<label for="privacy-policy">Privacy Policy</label>
|
||||||
<select name="privacy-policy" class="form-control" id="privacy-policy">
|
<select name="privacy-policy" class="form-control" id="privacy-policy">
|
||||||
<option value="website" selected="@(Model.Which != "google-play")">This website's policy</option>
|
<option value="website" selected="@(Model.Which != "google-play")">This website's policy</option>
|
||||||
<option value="google-play" selected="@(Model.Which == "google-play")">Google Play policy</option>
|
<option value="google-play" selected="@(Model.Which == "google-play")">Google Play policy</option>
|
||||||
@ -40,13 +40,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="margin-top: 10px;">
|
<div class="form-group" style="margin-top: 10px;">
|
||||||
<label for="position-title">Subject Matter</label>
|
<label for="subject">Subject</label>
|
||||||
<input type="text" class="form-control" id="position-title" name="position-title" placeholder="Describe your concerns here in a few words" maxlength="100">
|
<input type="text" class="form-control" id="subject" name="subject" placeholder="Describe your concerns here in a few words" maxlength="100">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="margin-top: 10px;">
|
<div class="form-group" style="margin-top: 10px;">
|
||||||
<label for="position-description">Description</label>
|
<label for="message">Description</label>
|
||||||
<textarea class="form-control" id="position-description" name="position-description" rows="5" required placeholder="Go into detail about the nature of your concerns."></textarea>
|
<textarea class="form-control" id="message" name="message" rows="5" required placeholder="Go into detail about the nature of your concerns."></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary" style="margin-top: 10px;">Submit</button>
|
<button type="submit" class="btn btn-primary" style="margin-top: 10px;">Submit</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user