This is silly question. I am calling rest service from Angular like that:
UserService.GetByUsername(username)
.then(function (user) {
if (user !== null && user.password === password) {
response = { success: true };
...
I can see from the debugger that there really is a user object with proper value from DB:
{
firstName: "Suba",
lastName: "Superi",
lastUpdated: "2015-06-02T18:14:56+03:00",
nickName: "",
password: "super",
userId: 2,
username: "super"
}
Question
Why this (user.password) is undefined: if (user !== null && user.password === password). Is there something in my notation or how can I check if password from DB is the same than user inputed in form? How can I get that password from JSON returned from rest, json parse maybe? I just started AngularJS and to implement authentication and login, so don't bother even password are plain text etc :) This is just annoying me. User is an object, I think that this is the reason, cause I assume that it is type of user?
user.passwordisundefined? If anythingpasswordwould beundefined. I don't see wherepasswordis defined.