3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 22:09:24 +01:00

Merge pull request #963 from slingamn/issue962_erasebug

fix #962
This commit is contained in:
Shivaram Lingamneni 2020-04-26 03:40:13 -07:00 committed by GitHub
commit feb6a63e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -1174,7 +1174,12 @@ func (am *AccountManager) Unregister(account string, erase bool) error {
var channelsStr string var channelsStr string
keepProtections := false keepProtections := false
am.server.store.Update(func(tx *buntdb.Tx) error { am.server.store.Update(func(tx *buntdb.Tx) error {
// get the unfolded account name; for an active account, this is
// stored under accountNameKey, for an unregistered account under unregisteredKey
accountName, _ = tx.Get(accountNameKey) accountName, _ = tx.Get(accountNameKey)
if accountName == "" {
accountName, _ = tx.Get(unregisteredKey)
}
if erase { if erase {
tx.Delete(unregisteredKey) tx.Delete(unregisteredKey)
} else { } else {

View File

@ -841,6 +841,8 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params
if erase { if erase {
// account may not be in a loadable state, e.g., if it was unregistered // account may not be in a loadable state, e.g., if it was unregistered
accountName = username accountName = username
// make the confirmation code nondeterministic for ERASE
registeredAt = server.ctime
} else { } else {
account, err := server.accounts.LoadAccount(username) account, err := server.accounts.LoadAccount(username)
if err == errAccountDoesNotExist { if err == errAccountDoesNotExist {