ユーザーの電子メールアドレスを更新するためのサーバー上のメソッドがあります。私はこれは、ユーザーが1つの電子メールアドレスを持っている間だけ動作しますが、これは今でもOKです知っている。MeteorのセキュリティのためにMeteor.userId()を使用していますか?
Meteor.methods({
'user.updateEmail'({ email, userId }) {
Meteor.users.update(
{ _id: userId },
{
$set: {
'emails.0.address': email,
'emails.0.verified': false,
},
},
);
},
});
イムリアクトコンポーネントにフォームからこのメソッドを呼び出す:
const formSubmit = e => {
e.preventDefault();
const email = e.target.email.value;
const userId = Meteor.userId();
Meteor.call('user.updateEmail', { email, userId }, err => {
if (err) {
alert(err);
}
});
};
これは安全ではないですか?私はクライアントからuserIdを渡しているのでおそらくそれは変更される可能性がありますか?