Skip to content

SignUp encoding data to JSON #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions packages/dart/lib/src/objects/parse_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ParseUser extends ParseObject implements ParseCloneable {
/// Requires [String] username, [String] password. [String] email address
/// is required as well to create a full new user object on ParseServer. Only
/// username and password is required to login
ParseUser(String username, this.password, String emailAddress,
ParseUser(String username, String password, String emailAddress,
{String sessionToken, bool debug, ParseHTTPClient client})
: super(keyClassUser) {
_debug = isDebugEnabled(objectLevelDebug: debug);
Expand All @@ -22,6 +22,7 @@ class ParseUser extends ParseObject implements ParseCloneable {

this.username = username;
this.emailAddress = emailAddress;
this.password = password;
this.sessionToken = sessionToken;
}

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

String password;
String _password;

String get password => _password;

set password(String password) {
if (_password != password) {
_password = password;
if (password != null) _unsavedChanges[keyVarPassword] = password;
}
}

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

Expand Down Expand Up @@ -149,10 +159,8 @@ class ParseUser extends ParseObject implements ParseCloneable {
return null;
}

final Map<String, dynamic> bodyData = _getObjectData();
bodyData[keyVarPassword] = password;
final Uri url = getSanitisedUri(_client, '$path');
final String body = json.encode(bodyData);
final String body = json.encode(toJson(forApiRQ: true));
_saveChanges();
final String installationId = await _getInstallationId();
final Response<String> response =
Expand Down