app.factory('User', function($resource) {
return $resource('/register', null, {
register: { method: 'put' }
});
});
In my angular controller, when I click on register button this method run:
$scope.register = function() {
$scope.user = new User({email: $scope.email, password: $scope.password});
$scope.user.$register();
}
It run but in console I got this : Failed to load resource: The network connection was lost.
This is my Totaljs controller:
exports.install = function(framework) {
framework.route('/register', registerPage);
framework.route('/register/', register, ['put']);
};
function registerPage() {
var self = this;
self.view('registerPage')
}
function register() {
var self = this;
// instead add new user I just return an existing user for test
var User = MODEL('user').Schema
User.find(function(err, docs) {
self.json(docs);
});
}
I think this is related to XSS, I am running in debug mode on 127.0.0.1:8000, am I right? What is the solution?
Thanks
Hi, this is the solution:
framework.route('/register/', register, ['put', 'xss']);
Thanks and give me a feedback.