fix: Fixes looking up accounts that were renamed. (#2078)
This commit is contained in:
parent
d92b735c18
commit
b4b7182ce6
3 changed files with 18 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ public partial class Account : IAccount, IComparable<Account>
|
|||
public static readonly TimeSpan EmptyInactiveDuration = TimeSpan.FromDays(30.0);
|
||||
|
||||
[InternString]
|
||||
[SerializableField(0)]
|
||||
[SerializableField(0, setter: "private")]
|
||||
private string _username;
|
||||
|
||||
[SerializableField(1)]
|
||||
|
|
@ -365,6 +365,19 @@ public partial class Account : IAccount, IComparable<Account>
|
|||
|
||||
public bool Deleted { get; private set; }
|
||||
|
||||
public bool TrySetUsername(string username)
|
||||
{
|
||||
if (username == _username || Accounts.GetAccount(username) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Accounts.Remove(this);
|
||||
Username = username;
|
||||
Accounts.Add(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetPassword(string plainPassword)
|
||||
{
|
||||
var phrase = _passwordAlgorithm is PasswordProtectionAlgorithm.SHA1 or PasswordProtectionAlgorithm.SHA2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue