Microsoft Security Advisory 3137909

This commit is contained in:
John Luo 2016-02-11 10:52:13 -08:00
parent 24b224e046
commit 57307ef2b7
4 changed files with 30 additions and 37 deletions

View File

@ -176,7 +176,8 @@ namespace IdentitySamples.Controllers
// //
// GET: /Manage/RemovePhoneNumber // GET: /Manage/RemovePhoneNumber
[HttpGet] [HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> RemovePhoneNumber() public async Task<IActionResult> RemovePhoneNumber()
{ {
var user = await GetCurrentUserAsync(); var user = await GetCurrentUserAsync();

View File

@ -5,30 +5,26 @@
<h2>@ViewData["Title"].</h2> <h2>@ViewData["Title"].</h2>
<p class="text-success">@ViewData["StatusMessage"]</p> <p class="text-success">@ViewData["StatusMessage"]</p>
<div> <div>
<h4>Change your account settings</h4> <h4>Change your account settings</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Password:</dt> <dt>Password:</dt>
<dd> <dd>
[
@if (Model.HasPassword) @if (Model.HasPassword)
{ {
<a asp-controller="Manage" asp-action="ChangePassword">Change</a> <text>[&nbsp;&nbsp;<a asp-controller="Manage" asp-action="ChangePassword">Change</a>&nbsp;&nbsp;]</text>
} }
else else
{ {
<a asp-controller="Manage" asp-action="SetPassword">Create</a> <text>[&nbsp;&nbsp;<a asp-controller="Manage" asp-action="SetPassword">Create</a>&nbsp;&nbsp;]</text>
} }
]
</dd> </dd>
<dt>External Logins:</dt> <dt>External Logins:</dt>
<dd> <dd>
@Model.Logins.Count [&nbsp;&nbsp;<a asp-controller="Manage" asp-action="ManageLogins">Manage</a>&nbsp;&nbsp;]
@Model.Logins.Count [ <a asp-controller="Manage" asp-action="ManageLogins">Manage</a> ]
</dd> </dd>
<dt>Phone Number:</dt> <dt>Phone Number:</dt>
<dd> <dd>
<p> <p>
@ -36,18 +32,19 @@
See <a href="http://go.microsoft.com/fwlink/?LinkID=532713">this article</a> See <a href="http://go.microsoft.com/fwlink/?LinkID=532713">this article</a>
for details on setting up this ASP.NET application to support two-factor authentication using SMS. for details on setting up this ASP.NET application to support two-factor authentication using SMS.
</p> </p>
@*@(Model.PhoneNumber ?? "None") [ @*@(Model.PhoneNumber ?? "None")
@if (Model.PhoneNumber != null) @if (Model.PhoneNumber != null)
{ {
<a asp-controller="Manage" asp-action="AddPhoneNumber">Change</a> <br />
@: &nbsp;|&nbsp; <text>[&nbsp;&nbsp;<a asp-controller="Manage" asp-action="AddPhoneNumber">Change</a>&nbsp;&nbsp;]</text>
<a asp-controller="Manage" asp-action="RemovePhoneNumber">Remove</a> <form asp-controller="Manage" asp-action="RemovePhoneNumber" method="post" role="form">
[<button type="submit" class="btn-link">Remove</button>]
</form>
} }
else else
{ {
<a asp-controller="Manage" asp-action="AddPhoneNumber">Add</a> <text>[&nbsp;&nbsp;<a asp-controller="Manage" asp-action="AddPhoneNumber">Add</a>&nbsp;&nbsp;]</text>
} }*@
]*@
</dd> </dd>
<dt>Two-Factor Authentication:</dt> <dt>Two-Factor Authentication:</dt>
@ -59,21 +56,15 @@
@*@if (Model.TwoFactor) @*@if (Model.TwoFactor)
{ {
<form asp-controller="Manage" asp-action="DisableTwoFactorAuthentication" method="post" class="form-horizontal" role="form"> <form asp-controller="Manage" asp-action="DisableTwoFactorAuthentication" method="post" class="form-horizontal" role="form">
<text> Enabled [<button type="submit" class="btn-link">Disable</button>]
Enabled
<button type="submit" class="btn btn-link">Disable</button>
</text>
</form> </form>
} }
else else
{ {
<form asp-controller="Manage" asp-action="EnableTwoFactorAuthentication" method="post" class="form-horizontal" role="form"> <form asp-controller="Manage" asp-action="EnableTwoFactorAuthentication" method="post" class="form-horizontal" role="form">
<text> [<button type="submit" class="btn-link">Enable</button>] Disabled
Disabled
<button type="submit" class="btn btn-link">Enable</button>
</text>
</form> </form>
}*@ }*@
</dd> </dd>
</dl> </dl>
</div> </div>

View File

@ -196,6 +196,8 @@ namespace Interop45.Controllers
// //
// GET: /Manage/RemovePhoneNumber // GET: /Manage/RemovePhoneNumber
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> RemovePhoneNumber() public async Task<ActionResult> RemovePhoneNumber()
{ {
var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null); var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null);

View File

@ -39,18 +39,17 @@
@* @*
<dt>Phone Number:</dt> <dt>Phone Number:</dt>
<dd> <dd>
@(Model.PhoneNumber ?? "None") [ @(If(Model.PhoneNumber, "None"))
@if (Model.PhoneNumber != null) @If (Model.PhoneNumber <> Nothing) Then
{ @<br />
@Html.ActionLink("Change", "AddPhoneNumber") @<text>[&nbsp;&nbsp;@Html.ActionLink("Change", "AddPhoneNumber")&nbsp;&nbsp;]</text>
@: &nbsp;|&nbsp; @Using Html.BeginForm("RemovePhoneNumber", "Manage", FormMethod.Post, New With {.class = "form-horizontal", .role = "form"})
@Html.ActionLink("Remove", "RemovePhoneNumber") @Html.AntiForgeryToken
} @<text>[<input type="submit" value="Remove" class="btn-link" />]</text>
else End Using
{ Else
@Html.ActionLink("Add", "AddPhoneNumber") @<text>[&nbsp;&nbsp;@Html.ActionLink("Add", "AddPhoneNumber") &nbsp;&nbsp;]</text>
} End If
]
</dd> </dd>
*@ *@
<dt>Two-Factor Authentication:</dt> <dt>Two-Factor Authentication:</dt>