Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix account manager not deserializing properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholastay committed Apr 21, 2017
1 parent 36baacd commit 607ba09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
19 changes: 10 additions & 9 deletions Xenon/Accounts/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Xenon.Accounts
public class Account : INotifyPropertyChanged
{
private string _username;
private string _password;
private string _token;
private string _friendlyName = null;

[JsonProperty("username")]
Expand All @@ -27,12 +27,12 @@ public string Username
}

[JsonProperty("token")]
public string Password
public string Token
{
get { return _password; }
get { return _token; }
set
{
_password = value;
_token = value;
NotifyPropertyChanged();
}
}
Expand All @@ -53,13 +53,14 @@ public string FriendlyName
public string DisplayName
=> (_friendlyName != null) ? _friendlyName : _username;

public Account(string username, string password, string friendlyName = null, bool passwordAlreadyHashed = false)
public Account() { }
public Account(string username, string passwordOrToken, string friendlyName = null, bool isToken = false)
{
this.Username = username;
this.Password =
passwordAlreadyHashed
? password
: Nexon.Auth.HashHexPassword(password);
this.Token =
isToken
? passwordOrToken
: Nexon.Auth.HashHexPassword(passwordOrToken);

this.FriendlyName = friendlyName;
}
Expand Down
1 change: 1 addition & 0 deletions Xenon/Accounts/Manager.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Manager(MainWindow mw)
_mw = mw;

List<Account> _accounts = JsonConvert.DeserializeObject<List<Account>>(Properties.Settings.Default.savedAccounts);

accounts = new ObservableCollection<Account>(_accounts);
listBox.ItemsSource = accounts;

Expand Down
2 changes: 1 addition & 1 deletion Xenon/Nexon/Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static async Task Login(Accounts.Account account)
{
RequestUri = new Uri("https://accounts.nexon.net/account/login/launcher"),
Method = HttpMethod.Post,
Content = new StringContent($"{{\"id\":\"{account.Username}\",\"password\":\"{account.Password}\",\"auto_login\":false,\"client_id\":\"{CLIENT_ID}\",\"scope\":\"{SCOPE}\",\"device_id\":\"{DeviceId}\"}}", Encoding.UTF8, "application/json")
Content = new StringContent($"{{\"id\":\"{account.Username}\",\"password\":\"{account.Token}\",\"auto_login\":false,\"client_id\":\"{CLIENT_ID}\",\"scope\":\"{SCOPE}\",\"device_id\":\"{DeviceId}\"}}", Encoding.UTF8, "application/json")
};
req.Headers.Add("User-Agent", "NexonLauncher node-webkit/0.14.6 (Windows NT 10.0; WOW64) WebKit/537.36 (@c26c0312e940221c424c2730ef72be2c69ac1b67) nexon_client");

Expand Down

0 comments on commit 607ba09

Please sign in to comment.