javascript - How do I check if a username is taken with parse.com when all User ACL:Public read/write is disable? -


how check if username taken parse.com javascript sdk when acl:public read/write disable in users inside user's class?

explanation: security reasons users in class/table user have private acl (access control list), or in other words acl public read/write disable, means authenticated users can read only own information.

as can imagine query users empty non logged in users so there no way check if user taken using query on user class

i manage work around singup new user , parse return 400 error information:

{code: 202, error: "username test taken"} 

the problem approach i'm doing validation on real time while user typing on text area field:

html angularjs:

<form name="form">     <h3>e-mail</h3>     <input class="form-control"            name="email"            placeholder="try john.doe@mail.com or bad@domain.com"            type="email"            required ng-model="email"            ng-model-options="{ debounce: 100 }"            ui-validate="{blacklist: 'notblacklisted($value)'}"            ui-validate-async="{alreadyexists: 'doesnotexist($modelvalue)'}"     >      <span ng-show='form.email.$error.blacklist'>this e-mail black-listed!</span>     <span ng-show='form.email.$error.alreadyexists'>this e-mail <b>already taken!</b></span>     <span ng-show='form.email.$pending'>verifying e-mail on server...</span>     <br>is form valid: {{form.$valid}} </form> 

javascript angularjs:

$scope.doesnotexist = function (value) {             parse.initialize(key0, key1);             var deferral = $q.defer();             var user = new parse.user();             user.set("username", "test");             user.set("password", "anyapssword");             user.signup(null, {                 success: function(user) {                     // hooray! let them use app now.                     console.log("success!");                     // holly shit have delete user :( , wait full form submmited                     user.destroy({                     success: function(myobject) {                         // object deleted parse cloud.                         console.log("destroy!!!!!!!!!!!");                     },                     error: function(myobject, error) {                         // delete failed.                         // error parse.error error code , message.                         console.log("failed destroy!!!!!!!!!!!");                     }                 });                     deferral.resolve(user);                 },                 error: function(user, error) {                     console.log("error: " + error.code + " " + error.message);                     deferral.reject("mierda!");                 }             });             return deferral.promise;         }; 

so how can check if username taken parse.com when acl:public read/write disable?

i'm using angularui plugin fast validation: https://htmlpreview.github.io/?https://github.com/angular-ui/ui-validate/master/demo/index.html

thanks!

you create cloud code function enables check if user name taken or not -- can lookup username masterkey(), allows read user table.

let me know if need more info.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -