QOL tweaks

This commit is contained in:
Andy Pack 2022-11-13 21:34:46 +00:00
parent bf8be55f76
commit 38a9bed8f4
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
5 changed files with 22 additions and 40 deletions

View File

@ -15,11 +15,6 @@
<label asp-for="Username"></label>
<input asp-for="Username" class="form-control" disabled />
</div>
<div class="form-group form-element">
<label asp-for="Input.PhoneNumber"></label>
<input asp-for="Input.PhoneNumber" class="form-control" />
<span asp-validation-for="Input.PhoneNumber" class="text-danger"></span>
</div>
<button id="update-profile-button" type="submit" class="btn btn-primary form-element">Save</button>
</form>
</div>

View File

@ -35,21 +35,18 @@ namespace Selector.Web.Areas.Identity.Pages.Account.Manage
public class InputModel
{
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }
}
private async Task LoadAsync(ApplicationUser user)
{
var userName = await _userManager.GetUserNameAsync(user);
var phoneNumber = await _userManager.GetPhoneNumberAsync(user);
Username = userName;
Input = new InputModel
{
PhoneNumber = phoneNumber
};
}
@ -79,17 +76,6 @@ namespace Selector.Web.Areas.Identity.Pages.Account.Manage
return Page();
}
var phoneNumber = await _userManager.GetPhoneNumberAsync(user);
if (Input.PhoneNumber != phoneNumber)
{
var setPhoneResult = await _userManager.SetPhoneNumberAsync(user, Input.PhoneNumber);
if (!setPhoneResult.Succeeded)
{
StatusMessage = "Unexpected error when trying to set phone number.";
return RedirectToPage();
}
}
await _signInManager.RefreshSignInAsync(user);
StatusMessage = "Your profile has been updated";
return RedirectToPage();

View File

@ -34,21 +34,16 @@
</form>
</div>
<div class="col-md-6 col-md-offset-2">
<section>
<h4>Use another service to register.</h4>
<hr />
@{
if ((Model.ExternalLogins?.Count ?? 0) == 0)
{
<div>
<p>
There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
for details on setting up this ASP.NET application to support logging in via external services.
</p>
</div>
}
else
{
@{
if ((Model.ExternalLogins?.Count ?? 0) == 0)
{
}
else
{
<section>
<h4>Use another service to register.</h4>
<hr />
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
<div>
<p>
@ -59,9 +54,9 @@
</p>
</div>
</form>
}
</section>
}
</section>
}
</div>
</div>

View File

@ -17,6 +17,12 @@
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Now">Now</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://sarsoo.xyz/posts/selector/">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://sarsoo.xyz/about">Contact</a>
</li>
</ul>
</div>
<partial name="_LoginPartial" />

View File

@ -19,10 +19,10 @@
else
{
<li class="nav-item">
<a class="nav-link text-dark" id="register" asp-area="Identity" asp-page="/Account/Register">Register</a>
<a class="nav-link text-light" id="register" asp-area="Identity" asp-page="/Account/Register">Register</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" id="login" asp-area="Identity" asp-page="/Account/Login">Login</a>
<a class="nav-link text-light" id="login" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>
}
</ul>