akveo / blur-admin

AngularJS Bootstrap Admin Panel Framework
http://akveo.github.io/blur-admin/
Other
11.37k stars 3.09k forks source link

Login as first page #97

Open JulioC opened 8 years ago

JulioC commented 8 years ago

How would one approach to use the login template as an initial route in the single-page application?

vazh commented 8 years ago

put it inside <div ui-view></div>

JulioC commented 8 years ago

I understand I would move the content currently in index.html to a route which would be parent (ie page) of the pages and create a login and register routes, being siblings of the page.

Is this the usual approach of the creators/users of blur-admin?

singhakash commented 8 years ago

Did anybody found the solution to this?. I have tried creating different module but it shows blank page with header and sidebar

ggunders commented 8 years ago

Playing with this as well. moved all dashboard code out of index.html and put in main.html.(left ui-view). moved html body from auth.html to login.html added a routeprovider in app.js to handle the / and /login routes for main.html and login.html login.html works ok but no styling main.html gives me just the dashboard with no sidebar or top bar. fun fun

alouane commented 8 years ago

It's so simple guys, juste follow theses steps http://akveo.github.io/blur-admin/articles/013-create-new-page/, once you are done go back to index.html and change these lines:

`

` also the `` To: `
` alse the `` $connected is your login auth lock, BUT keep in mind that this solution is absolutely not secure, it's juste for auth demo testing
shionryuu commented 8 years ago

I'm also trying to merge auth into BlurAdmin, but I got infdig error

chanakaDe commented 8 years ago

@alouane Hi buddy, I'm creating a ERP system (like that) using this and can you suggest me a more secure way to implement a logon system ? In my server , I have Json Token Based auth system :+1:

alouane commented 8 years ago

well there is a huge number of tutorials in the web, on how to secure angular apps (I don't really have the time to put all in this post, it's a long discussion), but you can start by checking this article https://www.toptal.com/web/cookie-free-authentication-with-json-web-tokens-an-example-in-laravel-and-angularjs. I think it's enough secure for your case. And DON'T put all your assets in one single page (index.html), you should separate the login system from other components, remember to block downloading any ressources (assets, js..) files in case the user doesn't have a valide token. Also don't forget to minify (once single css file and 1 js file, during the release -performance-) & obfuscate your code

You should know also that angular is not for building highly secured apps more than a fluid and a good user experience. Server side apps are always more secured (Old school!)

Shoko84 commented 8 years ago

Hey, i'm stucked too with that problem, i tried everything : create a new "parent" folder in the app folder with a similar link like the dashboard one, or create a new "page" like said above but nothing except a blank page..

It doesn't look so hard to put the auth page as default page but i stay stucked :disappointed: Did someone find something interesting ?

daguix commented 8 years ago

Hi Shoko84, do a $window.location.href = "/auth.html" in your angular application module .run() function to be redirected to the auth page. In therun() function you can check if a token is stored in your localStorage, check if the token grants user access and then redirect if auth.html if not.

Shoko84 commented 8 years ago

Thanks for your answer, i've already fixed my problem about redirecting to the auth.html and recently, integrated authentication functions and cookies sessions.

By the way, if someone is stucked about creating authentication on Blur Admin (Angular 1.4.x), i would be glad to help =)

wdescamps commented 8 years ago

@Shoko84 Hi ! that's exactly where i am stuck right now. I have another angular app (created with angular-fullstack) running alongside my blur admin, and my goal is to get the authentication cookies from that app, to authenticate my user in blur-admin. (which i use to gather all my database elements from the angular-fullstack app and make them modifyable) What method of authentication did you use? and in which files did you implement it ? thank you :)

daguix commented 8 years ago

I created a second ng-app for my auth.html, with a token authentication (JWT) on my server. When logged in, I get a JWT and I store the token in localStorage (with angular-local-storage module for example). Then I redirect to the index.html page.

In the main ng-app, in the theme.run.js file config, I retrieve the token for localStorage. Then I intercept all $http requests to my API, I add the header ‘Bearer + token’ and check if there is a 401 error. If it is the case, I redirect to auth.html, else I am ok. Example of the angular $httpProvider.interceptors is here https://www.toptal.com/web/cookie-free-authentication-with-json-web-tokens-an-example-in-laravel-and-angularjs https://www.toptal.com/web/cookie-free-authentication-with-json-web-tokens-an-example-in-laravel-and-angularjs My server is in nodejs express, I use passport with BearerStrategy to check whether the token is in my database and not expired.

Le 29 août 2016 à 11:13, wdescamps notifications@github.com a écrit :

@Shoko84 https://github.com/Shoko84 Hi ! that's exactly where i am stuck right now. I have another angular app (created with angular-fullstack) running alongside my blur admin, and my goal is to get the authentication cookies from that app, to authenticate my user in blur-admin. (which i use to gather all my database elements from the angular-fullstack app and make them modifyable) What method of authentication did you use? and in which files did you implement it ? thank you :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/akveo/blur-admin/issues/97#issuecomment-243073403, or mute the thread https://github.com/notifications/unsubscribe-auth/ANlAT3DMkyD62ezXG1fxVDCcdgJYZXmRks5qkqKggaJpZM4I-JHF.

Shoko84 commented 8 years ago

I created a different system than above, to make it short :

I'm only using the $cookies directive to store and create a session and.. that's all. You don't really to use other external module (i even found that's more complicated than doing yourself). About managing your session/routes, i used $stateProvider to set up pages you want to link and $urlRouterProvider to redirect if you want a certain link being redirected to another one (if you want to be redirected to the auth.html when you go on '/', do a .when('/', '/auth) for exemple).

There's also $location, which is a good thing to redirect manually to another page, but i suggest to not use it to redirect everything. I used it only for if the user is connected and that he's going on login or signup, then go to the dashboard. Doc for $location there.

I hope that helped !

ghost commented 7 years ago

Hi All, has any one got a simple answer to this? Looking for a means to handle the display of auth.html from app.js (not creating a login module within pages, this doesn't seem to work). Best