Yes is a system message but I think that there is no solution about that, because I just saw the relative method Umbraco.Web.Controllers.UmbLoginController.HandleLogin(LoginModel model) and the returned message is a simple english message and not a localized message
[HttpPost]
[ValidateAntiForgeryToken]
[ValidateUmbracoFormRouteString]
public ActionResult HandleLogin([Bind(Prefix = "loginModel")]LoginModel model)
{
if (ModelState.IsValid == false)
{
return CurrentUmbracoPage();
}
if (Members.Login(model.Username, model.Password) == false)
{
//don't add a field level error, just model level
ModelState.AddModelError("loginModel", "Invalid username or password");
return CurrentUmbracoPage();
}
TempData["LoginSuccess"] = true;
//if there is a specified path to redirect to then use it
if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
{
// validate the redirect URL
// if it's not a local URL we'll redirect to the root of the current site
return Redirect(Url.IsLocalUrl(model.RedirectUrl)
? model.RedirectUrl
: CurrentPage.AncestorOrSelf(1).Url());
}
//redirect to current page by default
return RedirectToCurrentUmbracoPage();
}
I think the only solution is that I create a custom login form.
the problem isn't the property name, but the Html.ValidationSummary's messages.
This is my login form (no problem with this)
This is the error I received with invalid credentials (no localized)
As you can see, I received an "Invalid username or password" error message but I would to see that message in italian...but as I wrote, I saw that the HandleLogin method return only a simple text and not a localized text (see above)
If your site is in Italian only, you can translate the message directly in the code.
if (Members.Login(model.Username, model.Password) == false)
{
//don't add a field level error, just model level
ModelState.AddModelError("loginModel", "Invalid username or password");
return CurrentUmbracoPage();
}
LoginForm Snippet return english messages instead of localized messages
Hi,
I'm using Umbraco 8 and I set my website with italian culture. All function properly except the login form messages.
I create a partial view based on the available snippets.
How can I localize those messages without creating a custom login form?
Thanks
A.
Hi Adriano,
are you referring to the system messages? I think you can solve it by checking the dictionary and adding the Italian translation.
M.
Hi Marina,
Yes is a system message but I think that there is no solution about that, because I just saw the relative method Umbraco.Web.Controllers.UmbLoginController.HandleLogin(LoginModel model) and the returned message is a simple english message and not a localized message
I think the only solution is that I create a custom login form.
A.
You can use https://our.umbraco.com/packages/developer-tools/umbraco-dictionary-metadataprovider/
just create Dictonary in relevant language
Login Login.PROPERTY_NAME = username
PROPERTY_NAME - property name in model
Hi Yakov,
the problem isn't the property name, but the Html.ValidationSummary's messages.
This is my login form (no problem with this)
This is the error I received with invalid credentials (no localized)
As you can see, I received an "Invalid username or password" error message but I would to see that message in italian...but as I wrote, I saw that the HandleLogin method return only a simple text and not a localized text (see above)
A.
If your site is in Italian only, you can translate the message directly in the code.
M.
Marina...the Umbraco.Web.Controllers.UmbLoginController.HandleLogin(LoginModel model) is an Umbraco Core method.
I should change the Umbraco Core method and re-compile all umbraco website...unthinkable.
I think that is more secure and flexible to create a custom login form with a custom surface controller to manage the login.
A.
I think you are right need to create new controller for it
Yep...I think so!!!
create your custom controller, don't change umbraco code
is working on a reply...