1

我想为我的 parse SignUp 函数添加一个额外的属性。我的代码就像

signUp: function(e) {
  var self = this;
  var username = this.$("#signup-username").val();
  var password = this.$("#signup-password").val();
  var sex=this.$("#signup-sex").val();
  Parse.User.signUp(username, password, sex, { ACL: new Parse.ACL() }, {
    success: function(user) {
      new ManageTodosView();
      self.undelegateEvents();
      delete self;
    }

如果我只传递用户名和密码,它可以工作并将用户添加到数据库。

4

3 回答 3

2
var attrs = {ACL: new Parse.ACL(), email: "email@email.com"};

Parse.User.signUp(username, password, attrs, {

    success: function(user) {
      //Set the code for sucess
    },

    error: function(user, error) {
     alert("Error: " + error.code + " " + error.message);
    }
});
于 2015-11-18T14:38:35.800 回答
1

你可以这样做

var user = new Parse.User();
user.set('username',name);
user.set('YOUR_COLUMN','ITS_VALUE');
user.set('password',password);
user.set('YOUR_COULMN','ITS_VALUE');

user.signUp(null,{
    success:function(user){
        NEXT OPERATION
    },
    error:function(error){
        res.send('error::'+error.message);
  }

});
于 2013-12-11T07:58:33.673 回答
0

该文档仅显示 Parse.User.signUp 函数的 4 个参数:http: //www.parse.com/docs/js/symbols/Parse.User.html#signUp

我的猜测是这会成功:

signUp: function (e) {
    var self = this;
    var username = this.$("#signup-username").val();
    var password = this.$("#signup-password").val();
    var sex = this.$("#signup-sex").val();
    var otherAttribute = 'test';
    Parse.User.signUp(username, password, {
        sex: sex,
        newAttribute: otherAttribute,
        ACL: new Parse.ACL()
    }, {
        success: function (user) {
            new ManageTodosView();
            self.undelegateEvents();
            delete self;
        }
    }
}
于 2012-11-01T08:31:16.267 回答