mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-26 13:59:44 +01:00
commit
355491d4e1
@ -834,6 +834,7 @@ func (am *AccountManager) loadRawAccount(tx *buntdb.Tx, casefoldedAccount string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (am *AccountManager) Unregister(account string) error {
|
func (am *AccountManager) Unregister(account string) error {
|
||||||
|
config := am.server.Config()
|
||||||
casefoldedAccount, err := CasefoldName(account)
|
casefoldedAccount, err := CasefoldName(account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errAccountDoesNotExist
|
return errAccountDoesNotExist
|
||||||
@ -906,8 +907,14 @@ func (am *AccountManager) Unregister(account string) error {
|
|||||||
delete(am.skeletonToAccount, additionalSkel)
|
delete(am.skeletonToAccount, additionalSkel)
|
||||||
}
|
}
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
|
if config.Accounts.RequireSasl.Enabled {
|
||||||
|
client.Quit(client.t("You are no longer authorized to be on this server"))
|
||||||
|
// destroy acquires a semaphore so we can't call it while holding a lock
|
||||||
|
go client.destroy(false)
|
||||||
|
} else {
|
||||||
am.logoutOfAccount(client)
|
am.logoutOfAccount(client)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errAccountDoesNotExist
|
return errAccountDoesNotExist
|
||||||
|
@ -206,6 +206,10 @@ func hsStatusHandler(server *Server, client *Client, command string, params []st
|
|||||||
accountName = params[0]
|
accountName = params[0]
|
||||||
} else {
|
} else {
|
||||||
accountName = client.Account()
|
accountName = client.Account()
|
||||||
|
if accountName == "" {
|
||||||
|
hsNotice(rb, client.t("You're not logged into an account"))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
account, err := server.accounts.LoadAccount(accountName)
|
account, err := server.accounts.LoadAccount(accountName)
|
||||||
|
@ -452,10 +452,6 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfname == client.Account() {
|
|
||||||
client.server.accounts.Logout(client)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = server.accounts.Unregister(cfname)
|
err = server.accounts.Unregister(cfname)
|
||||||
if err == errAccountDoesNotExist {
|
if err == errAccountDoesNotExist {
|
||||||
nsNotice(rb, client.t(err.Error()))
|
nsNotice(rb, client.t(err.Error()))
|
||||||
|
Loading…
Reference in New Issue
Block a user