Skip to content

Commit 65b5a48

Browse files
authored
SignUp encoding data to JSON (#470)
* signup - use toJson Co-Authored-By: itmesh <[email protected]> * fix password update
1 parent ee68a84 commit 65b5a48

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/dart/lib/src/objects/parse_user.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ParseUser extends ParseObject implements ParseCloneable {
1111
/// Requires [String] username, [String] password. [String] email address
1212
/// is required as well to create a full new user object on ParseServer. Only
1313
/// username and password is required to login
14-
ParseUser(String username, this.password, String emailAddress,
14+
ParseUser(String username, String password, String emailAddress,
1515
{String sessionToken, bool debug, ParseHTTPClient client})
1616
: super(keyClassUser) {
1717
_debug = isDebugEnabled(objectLevelDebug: debug);
@@ -22,6 +22,7 @@ class ParseUser extends ParseObject implements ParseCloneable {
2222

2323
this.username = username;
2424
this.emailAddress = emailAddress;
25+
this.password = password;
2526
this.sessionToken = sessionToken;
2627
}
2728

@@ -39,7 +40,16 @@ class ParseUser extends ParseObject implements ParseCloneable {
3940
static const String keyEmailAddress = 'email';
4041
static const String path = '$keyEndPointClasses$keyClassUser';
4142

42-
String password;
43+
String _password;
44+
45+
String get password => _password;
46+
47+
set password(String password) {
48+
if (_password != password) {
49+
_password = password;
50+
if (password != null) _unsavedChanges[keyVarPassword] = password;
51+
}
52+
}
4353

4454
Map<String, dynamic> get acl => super.get<Map<String, dynamic>>(keyVarAcl);
4555

@@ -157,10 +167,8 @@ class ParseUser extends ParseObject implements ParseCloneable {
157167
}
158168
}
159169

160-
final Map<String, dynamic> bodyData = _getObjectData();
161-
bodyData[keyVarPassword] = password;
162170
final Uri url = getSanitisedUri(_client, '$path');
163-
final String body = json.encode(bodyData);
171+
final String body = json.encode(toJson(forApiRQ: true));
164172
_saveChanges();
165173
final String installationId = await _getInstallationId();
166174
final Response<String> response =

0 commit comments

Comments
 (0)