Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. function login(username, password, callback) {
  2. var myResponse;
  3. var systemUser;
  4.  
  5. Users.getByLogin(username)
  6. .then(function (response) {
  7. systemUser = response.data;
  8. });
  9.  
  10. // Linha testada
  11. console.log("Senha: " + systemUser.password);
  12. console.log("Senha informada: " + password);
  13.  
  14. if (typeof systemUser == "undefined") {
  15. myResponse = { success: false, message: "Usuário inexistente!" };
  16. } else if (password == systemUser.password) {
  17. myResponse = { success: true, user: systemUser };
  18. } else {
  19. myResponse = { success: false, message: "Usuário ou senha incorretos!" };
  20. }
  21.  
  22. callback(myResponse);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement