mjhea0 / mean-auth Goto Github PK
View Code? Open in Web Editor NEWUser Auth with the MEAN Stack
Home Page: http://mherman.org/blog/2015/07/02/handling-user-authentication-with-the-mean-stack
User Auth with the MEAN Stack
Home Page: http://mherman.org/blog/2015/07/02/handling-user-authentication-with-the-mean-stack
So on Firefox and chrome the authentication works and once logged in it saves you until you logout
on Edge when i try to log in it just brings me constantly back to login so im guessing the problem is with the following section
AuthService.getUserStatus()
.then(function(user)
{`
.......
}
Hi Michael, thank you for this great tutorial. It works as expected except for one bit.
I have changed the restricted
to false
for the home page to make it available to all users. When I point the browser to localhost:3000
, it takes me to the home page and I'm able to view it, but it's displaying an error message in the console. I've tried it on both Firefox and Chrome, but it's the same problem; for some reason it seems that it's not recognizing next.access
Chrome message:
TypeError: Cannot read property 'restricted' of undefined
at main.js:58
Firefox message:
Error: next.access is undefined
@http://localhost:3000/main.js:58:1
Referring to this line of code:
if (next.access.restricted && !AuthService.isLoggedIn())
in this snippet of code in main.js file:
myApp.run(function ($rootScope, $location, $route, AuthService) {
$rootScope.$on('$routeChangeStart', function (event, next, current) {
AuthService
.getUserStatus()
.then(function () {
if (next.access.restricted && !AuthService.isLoggedIn()) {
$location.path('/login');
$route.reload();
}
});
});
});
I have modified this program.
i want to get all users who logged in and to display that users in html page.
In service.js
i have used
function register(username, password ,firstname) {
$http.get('/user/register')
.success(function(data) {
$scope.users = data;
console.log(data);
})
.error(function(data) {
console.log('Error: ' + data);
});
error is coming like
Error: $scope is undefined
register/<@http://localhost:3000/services.js:101:4
m/h.success/<@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:87:164
f/<@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:119:221
$eval@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:133:442
$digest@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:131:33
$apply@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:134:234
g@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:88:1
R@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:92:116
Zf/</v.onload@http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.min.js:93:155
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.