parse.com用户注册不起作用的问题 [英] Issue with parse.com user signup not working

查看:64
本文介绍了parse.com用户注册不起作用的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用parse.com和javaScript SDK 1.6.7.

Using parse.com and javaScript SDK 1.6.7.

下面的代码用于在我的网站上注册新用户,它可以正常工作.

The below code is used to register new users on my site, it works.

真正奇怪的是,如果我注册了一个用户,则他们将登录并转发到预期的页面.如果我随后注销它们并立即注册另一个用户,则它们是在后端创建的,但未登录,因此转发器不起作用.

What is really strange is, if I register a user, they are logged in and forwarded to the expected page. If I then log them out and straight away register another user, they are created in the back end but are not logged in and therefore the forwarder does't work.

是否有人在parse.com上遇到此问题???我的代码没有发现会导致此问题的任何错误吗?

Has anyone else experienced this issue with parse.com??? I dont see anything wrong with my code that would create this issue?

我已经在Chrome和Safari中进行了测试,并且这两种情况均发生了此问题,而且加班遵循相同的模式-如第一个用户工作,第二个用户不工作等等.

I've tested in Chrome and Safari and the issue happens in both, it follows the same pattern overtime - as in first user works, second user doesn't and so on.

我尝试清除缓存等也没有帮助.想知道它是否与解析有关?其他人是否经历过此事或知道如何解决?

I've tried clearing cache etc which hasn't helped either. Wonder if its an issue with parse? anyone else experienced this or know how to resolve?

$('#SignUp').click(function(e) {

    UserSignUp();
});



function UserSignUp() {

   var user = new Parse.User();


   userFirstname = $('#firstnamesu').val();
   userLastname = $('#lastnamesu').val();
   userUsername = $('#usernamesu').val();
   userGender = $('#gendersu').val();
   Email = $('#emailsu').val();
   PWP = $('#passwordsu').val();
   console.log("2");


   user.set("FirstName", userFirstname);
   user.set("LastName", userLastname);
   user.set("username", userUsername);
   user.set("gender", userGender);
   user.set("email", Email);
   user.set("password", PWP);

   console.log("3");

var uri = encodeURI('http://domain_home.html');
  user.signUp(null, {

    success: function(user) {
         if (!user.existed()) {
                window.location.href = uri;
            } 

    },
    error: function(user, error) {
      // Show the error message somewhere and let the user try again.

    }
  });

};

注销代码 ///////////////允许用户从站点注销////////////////////////////////////

Logout code //////////////Allows the user to logout from the site///////////////////////////////////

$(document).ready(function() {
    $('.logout').click(function(e) {
        Parse.User.logOut();
        window.location.href = "index.html";
    });
});

推荐答案

经过数小时的测试,基本上从头开始重新创建了页面,我发现了问题所在.与js代码完全无关,在我的html页面上,通过删除form元素可以将问题字段保留在表单中.

After hours of testing this and basically recreating the page from scratch I identified the issue. It was completely unrelated to the js code, on my html page the sign up fields were held within a form, by removing the form element the problem is resolved.

我并不是说这是解析的问题,但是任何时候我尝试将字段放入<form>时,问题都会自动出现.

I'm not suggesting this is an issue with parse, but anytime I try and put the fields into a <form> the issue presents itself.

我正在使用bootstrap html模板,因此从该角度来看,可能还会使它更加复杂.

I'm using a bootstrap html template so something could be complicating it further from that angle also.

我想如果有人遇到这样的问题,请尝试删除form元素.

I guess if anyone has an issue like this, try removing the form element.

这篇关于parse.com用户注册不起作用的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆