Переопределить существующее действие контроллера (вход и регистрация) в Nopcommerce версии 4.10 - PullRequest
0 голосов
/ 04 января 2019

Мне нужно переопределить вход в систему контроллера клиента, чтобы добавить проверку смс и мобильный вход в мой плагин когда я пишу следующий код в моем плагине RouteProvider.cs

    public void RegisterRoutes(IRouteBuilder routeBuilder)
            {
                routeBuilder.MapLocalizedRoute("CustomLogin",
                    "Login/",
                    new { controller = "CustomCustomer", action = "Login" },
                    new { },
                    new[] { "WebPooye.Plugins.SMS.WpSMS.Controllers" }
                );
            }
            public int Priority
            {
                get { return int.MaxValue; }
            }

У меня есть это исключение:

An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'Login' was not found. The following locations were searched:
/Themes/DefaultClean/Views/CustomCustomer/Login.cshtml
/Themes/DefaultClean/Views/Shared/Login.cshtml
/Views/CustomCustomer/Login.cshtml
/Views/Shared/Login.cshtml
/Pages/Shared/Login.cshtml

и когда я пишу это:

     public void RegisterRoutes(IRouteBuilder routeBuilder)
                {

                    routeBuilder.MapLocalizedRoute("CustomLogin",
                        "Login/",
                        new { controller = "CustomCustomer", action = "Login" },
                        new[] { "WebPooye.Plugins.SMS.WpSMS.Controllers" }
                    );
                }
                public int Priority
                {
                    get { return int.MaxValue; }
                }

У меня есть эта ошибка:

An error occurred while starting the application.
RouteCreationException: The constraint entry 'Length' - '1' on the route 'Login/' must have a string value or be of a type which implements 'Microsoft.AspNetCore.Routing.IRouteConstraint'.
Microsoft.AspNetCore.Routing.RouteConstraintBuilder.AddConstraint(string key, object value)

RouteCreationException: An error occurred while creating the route with name 'CustomLogin' and template 'Login/'.
Microsoft.AspNetCore.Routing.RouteBase..ctor(string template, string name, IInlineConstraintResolver constraintResolver, RouteValueDictionary defaults, IDictionary<string, object> constraints, RouteValueDictionary dataTokens)

RouteCreationException: The constraint entry 'Length' - '1' on the route 'Login/' must have a string value or be of a type which implements 'Microsoft.AspNetCore.Routing.IRouteConstraint'.
Microsoft.AspNetCore.Routing.RouteConstraintBuilder.AddConstraint(string key, object value)
Microsoft.AspNetCore.Routing.RouteBase.GetConstraints(IInlineConstraintResolver inlineConstraintResolver, RouteTemplate parsedTemplate, IDictionary<string, object> constraints)
Microsoft.AspNetCore.Routing.RouteBase..ctor(string template, string name, IInlineConstraintResolver constraintResolver, RouteValueDictionary defaults, IDictionary<string, object> constraints, RouteValueDictionary dataTokens)
...