Skip to content
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

Support changing password for nep6 wallet #1504

Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1d0ef09
Merge pull request #13 from neo-project/master
Qiao-Jin Mar 19, 2020
33e0e26
Merge pull request #16 from neo-project/master
Qiao-Jin Mar 23, 2020
8988eda
Merge pull request #20 from neo-project/master
Qiao-Jin Mar 23, 2020
e67fab5
Support changing password for Nep6 wallet
Mar 23, 2020
f44b115
Code optimization
Mar 23, 2020
b724a0a
Merge branch 'master' into support_changing_password_for_Nep6_wallet
shargon Mar 23, 2020
8cb7f22
Opde optimization
Mar 24, 2020
7f47701
Merge branch 'master' into support_changing_password_for_Nep6_wallet
shargon Mar 24, 2020
dbeb6fa
Code optimization
Mar 24, 2020
6e5bf94
Merge branch 'support_changing_password_for_Nep6_wallet' of https://g…
Mar 24, 2020
0af889c
Merge branch 'master' into support_changing_password_for_Nep6_wallet
Qiao-Jin Mar 25, 2020
5b2c0bf
Merge branch 'master' into support_changing_password_for_Nep6_wallet
Qiao-Jin Mar 27, 2020
fcf102b
Merge branch 'master' into support_changing_password_for_Nep6_wallet
Qiao-Jin Mar 27, 2020
0488b66
Update src/neo/Wallets/NEP6/NEP6Account.cs
Qiao-Jin Mar 27, 2020
f787d23
Change Nep6 wallet and account password changing strategy
Mar 27, 2020
8a34e66
Follow comment standard
shargon Mar 27, 2020
45d129f
Fix indent
shargon Mar 27, 2020
acc09c1
Fix indent
shargon Mar 27, 2020
d8ac5e6
Fix indent
shargon Mar 27, 2020
586bec2
Follow comment standard
shargon Mar 27, 2020
f0020f2
Merge remote-tracking branch 'Qiao-Jin/support_changing_password_for_…
shargon Mar 27, 2020
53d082c
Code optimization
Mar 30, 2020
d856f7f
Update NEP6Wallet.cs
erikzhang Mar 30, 2020
be37eb4
Rename methods
Mar 30, 2020
598a94a
Merge branch 'master' into support_changing_password_for_Nep6_wallet
Qiao-Jin Mar 31, 2020
defb346
Code optimization
Mar 31, 2020
4f8af9a
Code optimization
Apr 1, 2020
c00c3d1
Code optimization
Apr 1, 2020
7ebdd05
Merge branch 'master' into support_changing_password_for_Nep6_wallet
shargon Apr 1, 2020
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
29 changes: 12 additions & 17 deletions src/neo/Wallets/NEP6/NEP6Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,36 +304,31 @@ public override bool VerifyPassword(string password)

public bool ChangePassword(string password_old, string password_new)
{
bool isSuccessful = true;
bool succeed = true;
lock (accounts)
{
Parallel.ForEach<NEP6Account>(accounts.Values, (account, state) =>
Parallel.ForEach(accounts.Values, (account, state) =>
{
if (!account.ChangePasswordPrelude(password_old, password_new))
{
state.Stop();
isSuccessful = false;
succeed = false;
}
});
}
if (!isSuccessful)
if (succeed)
{
Parallel.ForEach<NEP6Account>(accounts.Values, account =>
{
account.KeepPassword();
});
return false;
foreach (NEP6Account account in accounts.Values)
account.ChangePassword();
if (password != null)
password = password_new;
}
Parallel.ForEach<NEP6Account>(accounts.Values, account =>
{
account.ChangePassword();
});
if (password != null)
else
{
password = password_new;
foreach (NEP6Account account in accounts.Values)
account.KeepPassword();
}
Save();
Qiao-Jin marked this conversation as resolved.
Show resolved Hide resolved
return true;
return succeed;
}
}
}