Open Ridermansb opened 8 years ago
Hey,
I not able to reproduce this error with the code that you have written here. Can give me more details about this ?
Thanks
Hi @criroselli , sorry for delay.
I`m have a Auth service register as folow:
.factory('Auth', AuthService)
And in my controller, when click in logon button..
Auth.login($scope.email, $scope.senha)
.then(function (wasSuccess) {
if (wasSuccess) {
$state.go('user.home', {});
} else {
$mdToast.show(
$mdToast.simple()
.content('Error when try to logon.').position('top right')
);
}
}).catch(function (err) {
$mdToast.show(
$mdToast.simple()
.content(err.responseText).position('top right')
);
}).done(function () {
the login function is ..
login: function (email, password) {
if (user.isLogged()) {
this.logout();
}
user = new Stamplay.User().Model;
return user.login(email, password).then(function () {
return user.currentUser().then(function () {
var givenRole = user.get('givenRole'); // THIS IS UNDEFINED
// Most cases, emailVerified property in Stamplay are true, but here return false ?
var emailVerified = user.get('emailVerified');
if (!emailVerified) {
console.error(email, ' was not verified');
return false;
}
return user.isLogged();
});
});
},
The same code above
Just for the records.. the givenRole
is undefined.
Right now I'm adding a angular-stamplay, maybe this resolves the problem.
I build a demo app on github, maybe it can help to understand.
This is a simple app, to made a login with
Username> My current email address Password> 12345
One problem I've noticed is that user.currentUser()
does not correctly fulfill the user data when called after user.login()
function.
Perhaps this is because the function does not save th login session.
What did I do to solve this problem (issue 1) was soon after login, save the user information.
This code mention above can be used for demonstration propose, maybe can you help me fixin same issues :)
On some occasions the sdk returns false for emailConfirmed, even though I have already been confirmed.
In editor is correct!