2016-08-15 1 views
0

Ich benutze Methode Users.on ('resetPasswordRequest') in Loopback das Passwort für den ClientSenden Sie den Client-JSON mit Users.on ('resetPasswordRequest') in Loopback

Users.on('resetPasswordRequest', function (info) { 
    var html = 'abcxyz'; 
    Users.app.models.Email.send({ 
     to: info.email, 
     from: '[email protected]', 
     subject: 'Password reset', 
     html: html 
    }, function (err ,email) { 
     if (err) return console.log('> error sending password reset email'); 
     console.log('> sending password reset email to:', info.email); 
    }); 
    }); 

Wie kann ich JSON senden formatiert abrufen ?

Antwort

0

Sie müssen remote hook zum User Modell hinzufügen. Ich würde extending das eingebaute Benutzermodell dazu empfehlen.

Von dort haben Sie Zugriff auf das ExpressJS-Antwortobjekt ctx.res. Sie können das Antwortobjekt von dort aus so ändern, wie Sie möchten.

Verwandte Themen