add exception filter when user not connected default to needing authentication and apply anonymous to some actions add user in get requests add user relation in link, comment and vote signup and in are ok now!
16 lines
483 B
Plaintext
16 lines
483 B
Plaintext
@model HN.Application.CommentLinkCommand
|
|
|
|
<div>
|
|
<h2>Add a comment</h2>
|
|
@if(User.Identity.IsAuthenticated) {
|
|
<form asp-action="Create" asp-controller="Comments" method="post">
|
|
<input type="hidden" asp-for="@Model.LinkId" />
|
|
<textarea asp-for="@Model.Content"></textarea>
|
|
<span asp-validation-for="@Model.Content"></span>
|
|
|
|
<button type="submit">Post a comment</button>
|
|
</form>
|
|
} else {
|
|
<p>Only logged in users can comment.</p>
|
|
}
|
|
</div> |