简体   繁体   中英

ng-admin I need to add a login form in the main layout

I am a beginner in AngularJS, I use ng-admin( https://github.com/marmelab/ng-admin ), to create an admin panel, but I need to create a previous login authentication view, once authenticated I send the user to the dashboard, somebody had done it before? Need I create two apps to do it?

If you need login authentication, yes, you will have to build it. See ng-form documentation at https://docs.angularjs.org/api/ng/directive/ngForm . Create a login form and integrate it with the authentication backend.

The Posters Galore demo is an open-source ng-admin backend with built-in authentication (albeit with a fake authentication provider). Take a look at it!

在此处输入图片说明

You need to dig through the ng-admin-demo code to see how it can be done in a simplistic way. However, their example is not really tied into the application. You'd need to build your own authentication service and integrate it into the app. You'll need to build proper hooks to detect when authentication expires and set the right headers on REST requests. Demo app currently doesn't do any of this.

Check out this code to get you started with AngularJS authentication. https://github.com/cornflourblue/angular-registration-login-example I'm not related to it and the project has nothing to do ng-admin, but has a decent structure you can base your work on.

You'll need to work out how to integrate something like this into your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM