meteor/meteor

Login and CreateUser method send back the added message without fully fields

Mae623 opened this issue · 4 comments

Meteor 2.15.
accounts-base@2.2.10

When I call the Login or CreateUser method in client, the client will receive a added ddp message, whose fields is not fully:
{"msg":"added","collection":"users","id":"jD2HdzpSDQXmM4fBK","fields":{"emails":[{"address":"789@qq.com","verified":false}]}}

If client subscribe user after login, the client will receive a changed message after this added message:
{"msg":"changed","collection":"users","id":"jD2HdzpSDQXmM4fBK","fields":{"createdAt":1712734497,"language":"zh","timezone":"CST","sortedRecurringIds":["j9M34LZmPL73m9nCH","AJ5zsM5MY3Fxt7r3m","wAySnvQiwJhpWj88v","uNEgTsagsNfyYqHKJ","uWSzGyFQ4NifTJerr","WER4nWaA679twZEgQ","bTgJxfHKEAgeZEm9r","tvDrSJCxLiPJisH2p","LeZgrrmy2KqJrRrGc","eGzPhmr9CyfgZnL9i","kxZGapM4wspDQqncL","6Dzwwe6PqpLXA9WWT","aY9Du4xRSvrLjEdWr","7DHKWmzRwAH7QkTKJ","nWBnwWfct4ArL9jY3","vG5bLyba2hBw8CbAh","P4byKi973xbLR8BBv","tRz2Aiz6KRa85aZC2","REWGqGnEjASCv6Wy9","bCxXYJzb9EGKx49uk"],"dark":false}}

Now, this question very trouble me. The client will put the data from added message into client database, then change this data according to changed message. So, the added message without fully fields will result in error data.

I expect this added message contain all fields, or there is no added message caused from Login and CreateUser method.

By the way, this added message sometimes received before than 'result' and 'update' ddp message:
{"msg":"connected","session":"e88doLkqWghXmaMnh"} {"msg":"added","collection":"users","id":"jD2HdzpSDQXmM4fBK","fields":{"emails":[{"address":"789@qq.com","verified":false}]}} {"msg":"updated","methods":["login-3"]} {"msg":"result","id":"login-3","result":{"id":"jD2HdzpSDQXmM4fBK","token":"xdC94BG4tATu_Pq6b4HXc2YHktNYg-fjCURyGjTMEha","tokenExpires":{"$date":2029738253256},"type":"resume"}}

My call method code as below:
1.signin-login
call( methodNameLogin, args: <dynamic>[ <String, dynamic>{ keyUser: <String, String>{keyEmail: _email}, keyPassword: <String, dynamic>{ keyDigest: sha256.convert(utf8.encode(_password)).toString(), keyAlgorithm: keySha256, }, } ], )

2.signin-createuser
call( methodNameCreateUser, args: <dynamic>[ <String, dynamic>{ keyEmail: _email, keyPassword: _password, keyTimezone: timezone, keyLanguage: language, keyDark: dark, } ], )

3.resume-login
if (_loginTokenInfo != null) { final String loginToken = _loginTokenInfo!.value; final String loginWithTokenMessage = json.encode(<String, dynamic>{ keyMSG: keyMethod, keyMethod: keyLogin, keyParams: <dynamic>[ <String, String>{keyResume: loginToken} ], keyId: '$keyLogin-$_idCounter', }); _socket!.sink.add(loginWithTokenMessage); }

accounts-password@2.4.0