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> <label asp-for="Username"></label>
<input asp-for="Username" class="form-control" disabled /> <input asp-for="Username" class="form-control" disabled />
</div> </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> <button id="update-profile-button" type="submit" class="btn btn-primary form-element">Save</button>
</form> </form>
</div> </div>

View File

@ -35,21 +35,18 @@ namespace Selector.Web.Areas.Identity.Pages.Account.Manage
public class InputModel public class InputModel
{ {
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }
} }
private async Task LoadAsync(ApplicationUser user) private async Task LoadAsync(ApplicationUser user)
{ {
var userName = await _userManager.GetUserNameAsync(user); var userName = await _userManager.GetUserNameAsync(user);
var phoneNumber = await _userManager.GetPhoneNumberAsync(user);
Username = userName; Username = userName;
Input = new InputModel Input = new InputModel
{ {
PhoneNumber = phoneNumber
}; };
} }
@ -79,17 +76,6 @@ namespace Selector.Web.Areas.Identity.Pages.Account.Manage
return Page(); 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); await _signInManager.RefreshSignInAsync(user);
StatusMessage = "Your profile has been updated"; StatusMessage = "Your profile has been updated";
return RedirectToPage(); return RedirectToPage();

View File

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

View File

@ -17,6 +17,12 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Now">Now</a> <a class="nav-link" asp-area="" asp-page="/Now">Now</a>
</li> </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> </ul>
</div> </div>
<partial name="_LoginPartial" /> <partial name="_LoginPartial" />

View File

@ -19,10 +19,10 @@
else else
{ {
<li class="nav-item"> <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>
<li class="nav-item"> <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> </li>
} }
</ul> </ul>