Override ABP.IO Login page - abp

I am using Abp.io .net core template with MVC/Razor model.
I am trying to override just the cshtml of the login page. Followed the documentation at https://docs.abp.io/en/abp/4.4/UI/AspNetCore/Customization-User-Interface#overriding-a-razor-page-cshtml
I downloaded the login.cshtml template from https://github.com/abpframework/abp/tree/dev/modules/account/src/Volo.Abp.Account.Web/Pages/Account and placed it in my Web project under Pages/Account/Login.cshtml
Build is successfull.
When running, click on login page and below error is shown:
An unhandled exception occurred while processing the request.
ComponentNotRegisteredException: The requested service 'Volo.Abp.Account.Web.Pages.Account.LoginModel' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Any idea what I am missing? I just want to replace the cshtml and not the underlying code.
Thanks.

Does your web module depends on AbpAccountWebIdentityServerModule or AbpAccountWebModule? (https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs#L50)
Also, there is a community article about "how to customize login page". You can read it from here.
You will see in the article, a new model created and inherited from the LoginModel. And it's used as the modal of the Login.cshtml file.
You can examine the source code of the article, from here.

Related

ExtJS6: Partial App load for special request that always opens in a new window

We have a ExtJS7 app, that for special requests like reset password, that always opens a new tab via email reset link, get loaded in full. We would like to load only few pages that are needed to load for these kind of request
Is there a way in ExtJS that would only load a particular page and its dependencies
I have not seen tutorials on this subject in official documentation. Myself did the following - just created another app (or bundle) for logging. The backend is responsible for the logic of what to display (loginapp or mainapp) - in the absence of a session, the user receives the app login
Absolutely. You can make another app - each app is a page, and will have its own packaged dependencies.
That's the easiest approach. A more complicated approach is to break your application into several ExtJS packages. You can then configure the app.json to exclude all of the packages from the micro loader. You then need to load these packages dynamically, presumably after logging in.
Doing this, though, is extremely complicated, and almost certainly not worth doing.

How to make a login page outside the single page application skeleton

I have an angularJS single page application. It is an admin dashboard. However I do not want anyone to access the dashboard unless he is logged in.
Problem that I am facing is when I create a login template, it is usually part of the admin dashboard, since it is a single page application. However I want the login page to look completely different from the single page application index default view. Same for registration page.
What are ways to make a page different completely from the skeleton of the single page application with angular ?
I am sorry if the question is broad but I am new to angular. I do not care about any code written I just would like to understand a good technique for a sort of thing.
Feel free to send me any articles or documentations that explains similar technique
If I am understanding your question correctly, what you need to do is the following.
Use ui-router to control the navigation (or routing) in your application. Note that ui-router will become native in AngularJS 2, right now you will need to use NPM or Bower to include it in your project.
Then use the events it provides to determine if the user needs to logon before accessing the given route. If logon is required you can redirect to the logon page, the redirect back upon successful authentication.

Issues using angular-piwik

I am using https://github.com/mike-spainhower/angular-piwik for tracking a single page angular web application. I have included page tracking snippet in index.html using angular-piwik directive as under:
<ngp-piwik ngp-set-js-url="//.../piwik.js" ngp-set-tracker-url="//.../piwik.php" ngp-set-site-id="1"></ngp-piwik>
And inject Piwik service in my app module.
I have below issues:
Error "The method setTrackerUrl is registered more than once in "_paq" variable. Only the last call has an effect." shows up in console. Same error is thrown for setSiteId method as well. In spite of these 2 errors, I am able to see my page getting tracked on Piwik dashboard. I want to get rid of these 2 errors.
Unable to track individual states/urls implemented using angular ui-view. I want to track all the urls that are defined in my application using $stateProvider and their usage should show under Piwik pages log under actions tab.
There is not enough documentation/example for using angular-piwik.
This should be fixed in 1.3.1. Please update to this version.
https://github.com/mike-spainhower/angular-piwik/tree/1.3.1

angularjs technique for login then redirecting to dashboard page

I'am doing my first AngularJS project with ASP.NET Web API backend. What I am trying to do is, whenever a user visits www.mydomain.com, a login page (index.html) will displayed. After successfull login, he will be redirected to the dashboard.html (this is the shell page, partial views go here). My project structure is shown below-
I am confused about some issues:
Is this the best/common practices what i am trying to do in above?
As because dashboard.html is the main page, should i place app.js on dashboard.html?
If i put app.js on dashboard.html, will index.html (login page) have another app.js (i.e. loginApp.js)?
How should I manage the login state i.e. IsUserLoggedId, UserId etc in angular part?
This question may be silly. I googled, but did not find any example/article addressing such issue.
Would you please help?
Thank you in advance.
I am not sure how ASP.NET deals with it, but to my knowledge ASP.NET is just a server side framework whereas AngularJS is client side framework.
These two framework solve different problem, but has some overlapping features.
If you start using angularjs, then most of the time you will deal with the term "Single Page Application (SPA)".
There are different approaches in how you can handle the url redirection after login. I will just show you two example. There are many more how you can handle the user authentication and session.
First Approach:
In SPA, most of the time browser will change the url route and state directly in the page itself without making the entire page request from the server.
With that said, your dashboard.html will most likely be come a static template file which will be loaded from the browser directly. (i.e. the server does not dynamically parse the dashboard.html but only serve as a static file). Upon the user login, the angularjs will fire a asynchronous HTTP request into the ASP.NET authentication end point. A successful login may return a token to the browser, and the client will use it to manage the user session. At the same time, the Angular will have to change the route to /dashboard/. Notice that that the entire flow happens transparent to the user, it does not fire a full page HTTP request.
Second Approach:
Alternatively, if you choose to redirect from the server, you will have to send a HTTP Redirect 302. and since HTTP redirect will eventually call make a full HTTP request to /dashboard/, and it will then have to reload and bootstrap the angular app.js from the browser again. In this case, the user will have to wait for the dashboard page to be processed by the server upon login
Issues:
Is this the best/common practices what i am trying to do in above? there are many approaches, I think it is best to find the one that works for you. If you have a RESTful API, then you might want to have a look at the SPA approach in more detail.
As because dashboard.html is the main page, should i place app.js on dashboard.html? in SPA, you don't need to load app.js twice. but if you use the second approach, you have to reload the app.js again.
If i put app.js on dashboard.html, will index.html (login page) have another app.js (i.e. loginApp.js)? depends on your approach as stated above
How should I manage the login state i.e. IsUserLoggedId, UserId etc in angular part? Authentication Strategy, UNIX style authorization
There are more official guide that can help AngularJS Developer Guide.
Hope this helps you to integrate with the ASP.NET authentication mechanism.
you should have multiple shell pages. this link can help you...
refer to Multiple Shell Pages part.

Salesforce.com - Why uploading of Apex class is not working?

I have an Apex class (controller) originally developed under Developer Edition and need to upload it to production which is Enterprise Edition.
The upload fails with following message
classes/RenewalController.cls(RenewalController):An error occurred on your page.
package.xml(RenewalController):An object 'RenewalController' of type ApexClass
was named in manifest but was not found in zipped directory
The same message when I try to use Force.com IDE: Save error: An error occurred on your page.
This class is working under Developer Edition but not with Enterprise.
What can be the problem?
Dmytro, you are correct. Visualforce pages, apex classes, and components must be uploaded in the correct order. Generally the pattern I use is upload the controllers, components, and then visualforce pages.
Controller class may reference other custom SalesForce objects like pages. If controller is uploaded before these objects Save error: An error occurred on your page. is reported.
Correct order of uploading of custom components should be used.

Resources