Skip to content

Commit

Permalink
WIP: add language resource
Browse files Browse the repository at this point in the history
  • Loading branch information
neozhu committed Aug 31, 2021
1 parent d7a9e8f commit 9bdc3a1
Show file tree
Hide file tree
Showing 28 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<div class="container py-4 py-lg-5 my-lg-5 px-4 px-sm-0 text-white d-flex align-items-center justify-content-center">
<form id="js-login" role="form" class="text-center text-white mb-5 pb-5" method="post">
<input type="hidden" asp-for="Input.UserName" />
<input type="hidden" asp-for="Input.Email" />
<input type="hidden" asp-for="ReturnUrl" />
<div class="py-3">
<img src="@Model.Input.ProfilePictureDataUrl" class="img-responsive rounded-circle img-thumbnail" alt="thumbnail">
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public class LockoutModel : PageModel

[BindProperty]
public InputModel Input { get; set; }

[BindProperty]
[Required]
public string UserName { get; set; }
[BindProperty]
public string ReturnUrl { get; set; }
public class InputModel
{
[Required]
Expand All @@ -43,12 +47,13 @@ public LockoutModel(
_logger = logger;
}

public async Task OnGetAsync()
public async Task OnGetAsync(string userName="", string returnUrl="")
{
var userId = _currentUserService.UserId;
if (!string.IsNullOrEmpty(userId))
UserName= userName;
ReturnUrl = returnUrl;
if (!string.IsNullOrEmpty(UserName))
{
var user = await _userManager.FindByIdAsync(userId);
var user = await _userManager.FindByNameAsync(UserName);
if (user != null)
{
Input = new InputModel()
Expand Down Expand Up @@ -89,7 +94,7 @@ public async Task<IActionResult> OnPostAsync(string returnUrl = null)
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
return RedirectToPage("./Lockout", new { userName = Input.UserName, ReturnUrl = returnUrl });
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -91,7 +91,7 @@ public async Task<IActionResult> OnPostAsync(string returnUrl = null)
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
return RedirectToPage("./Lockout",new {userName= Input.UserName, ReturnUrl = returnUrl });
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page
@using System.Web
@inject Microsoft.Extensions.Localization.IStringLocalizer<LoginModel> _localizer
@inject Microsoft.Extensions.Localization.IStringLocalizer<LogoutModel> _localizer
@model LogoutModel
@{
ViewData["PageName"] = "logout";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
<data name="Forgot your password?" xml:space="preserve">
<value>Forgot your password?</value>
</data>
<data name="login" xml:space="preserve">
<value>login</value>
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
<data name="Forgot your password?" xml:space="preserve">
<value>Forgot your password?</value>
</data>
<data name="login" xml:space="preserve">
<value>login</value>
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<data name="Forgot your password?" xml:space="preserve">
<value>忘记你的密码?</value>
</data>
<data name="login" xml:space="preserve">
<data name="Login" xml:space="preserve">
<value>登录</value>
</data>
<data name="Password" xml:space="preserve">
Expand Down

0 comments on commit 9bdc3a1

Please sign in to comment.