GithubHelp home page GithubHelp logo

Comments (6)

colinskow avatar colinskow commented on July 23, 2024 1

OK, now I understand exactly what you are saying. Currently if you want to change the whitelist, you have to repeat it:

whitelist: [
      'name',
      'username',
      'email',
      'password',
      'confirmPassword',
      ...
    ],

I'll work on this for the next version of SuperLogin, but don't know when I'll get to it. If you can do I pull request with a passing test in user.spec.js then I would be happy to merge it.

from superlogin.

raymatos avatar raymatos commented on July 23, 2024

Dont have access to push a new branch, was going to fix another issue i found

from superlogin.

colinskow avatar colinskow commented on July 23, 2024

See line 168 of config.example.js for the built-in solution.

Please close if this does what you want it to do.

from superlogin.

raymatos avatar raymatos commented on July 23, 2024

I am using the config, however extend does not work how it needs to work in order to make this s function correctly.

Adding any valid to the config user model will result in a error stating that username, password and confirm password is not passed.

from superlogin.

colinskow avatar colinskow commented on July 23, 2024

You shouldn't need to use JQuery extend. Anything you put in the config file under userModel is automatically merged into the model.

    if(typeof config.getItem('userModel') === 'object') {
      userModel = extend(true, userModel, config.getItem('userModel'));
    }

Please explain specifically what you want to do and include some example code so I can understand your situation.

from superlogin.

raymatos avatar raymatos commented on July 23, 2024

So what im trying to say is the node extend is basically a clone to jquery extend. And extend will not merge 2 arrays.

So for example, if you were to add this to the config file

userModel: {
    whitelist: [
      'interests',
      'unit',
      'age',
      'subscribe',
      'zipcode'
    ]
  }

You would get an error saying the username, password, and confirmPassword is required. This is because userModel = extend(true, userModel, config.getItem('userModel')); would return the whitelist array like this

whitelist: [
      'interests',
      'unit',
      'age',
      'subscribe',
      'zipcode'
    ]

This is because extend will overwrite the array rather then merge them. But what you really want is a unique merge.

Hope that makes more sense.

from superlogin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.