samedi 9 mai 2015

Meteor.loginwithpassword not working on iOS

I'm working on a Meteor app for iOS 8.3 + and I'm having issues getting the accounts-password package to work on iOS.

I have this code for my login:

Template.login.events({
"submit #login-form": function()
{
    $.ajax({
        url: "http://ift.tt/1dKCRwD",
        type: "POST",
        dataType: "json",
        data: $("#login-form").serializeArray(),
        error: function(data)
        {
            alert(data.responseJSON[0]);
        },
        success: function(Drupal)
        {
            alert("User being checked...");
            Accounts.createUser({
                username: $("#username").val(),
                password: $("#password").val(),
                email: Drupal.mail,
                profile: 
                    {
                        uid: Drupal.uid,
                        name: Drupal.user.field_first_name.und[0].safe_value + " "+ Drupal.user.field_last_name.und[0].safe_value
                    }

            }, function(error, result){

                if(error)
                {

                    Meteor.loginWithPassword($("#username").val(), $("#password").val());
                    alert("User Logged In");
                    $('.login').animate({
            }, 0, function() {
                $('.sign-in').removeClass('open');
                $('.login').removeClass('open');

            });

                } else
                {
                    alert("User Created");
                }

            });

        }
    });

    return false;
}

});

As you can see I'm validating a Drupal user, which works fine. The application itself works on the browser fine as well. The issue I get is that when I create the native ios app, the Meteor.loginwithpassword and Accounts.createUser methods stop working.

For testing purposes, I created a new meteor app that only had the {{> loginButtons}} template in and deployed it to iOS. The sign in shows up in the simulator. It does not show up on the device.

Here's a full list of the packages I'm using:enter image description here

What am I doing wrong here?

BTW, please let me know if there's anyway at all I can improve my question.

Aucun commentaire:

Enregistrer un commentaire