2017-03-05 55 views

回答

1

驗證是一個模型本身。我的意思是它影響操作鉤子而不是遠程鉤子。

你需要創建一個遠程鉤子是這樣的:

client.beforeRemote('create', function(ctx, instance, next){ 
    if(ctx.args.data.password.length < 20){ 
    return next(PsswordValidationError); 
    /* assuming you have this error object 
     or return any error validation you want */ 
    } 
    next(); 
}); 
+0

我希望這是一個內置的功能..太糟糕了! PasswordValidation錯誤是否存在? – JavaCake

+0

@JavaCake編號'PasswordValidation'不存在。 –