Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49172

Ionic login php + token

$
0
0

@leugim_ohlavrac wrote:

Hi guys,

I'm following this tutorial written by Mr Simon about create a login.
But I'm facing a problem when I want it to check the credentials stored in a database with php.

I modified the services.js to check, but I can figure out what is wrong!
Please I need your help, i'm stuck on this...

Here is the code I modified in service.js:

  var login = function( name, pw) {

       $rootScope.rsJSON = [ ];
       //
       var req = {
     method: 'POST',
     url: 'http://localhost/test/index.php',
     headers: {
       'Content-Type': undefined
     },
     data: { usuario : name , contrasena : pw },
     dataType: "jsonp"
    }

    $http(req)
        .success(function(data, $state) {
       //
    return $q(function(resolve, reject) {
      if (typeof(data.USUARIO) == "undefined") {
        // Make a request and receive your auth token from your server
         reject('Login Failed.');
      } else {

          storeUserCredentials(name + '.yourServerToken');
        resolve('Login success.');
      }
    });

         })
        .error(function(data) {
            console.log('Error: ' + data);
        });

  };

I received the follow errors:

Posts: 7

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 49172

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>