3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

read device ID from SASL as well

This commit is contained in:
Shivaram Lingamneni 2020-06-16 04:57:49 -04:00
parent 48d654d60c
commit 90e697f454

View File

@ -241,6 +241,9 @@ func authPlainHandler(server *Server, client *Client, mechanism string, value []
// distinguish user/ident from account name
if strudelIndex := strings.IndexByte(authcid, '@'); strudelIndex != -1 {
authcid = authcid[:strudelIndex]
if !client.registered {
rb.session.deviceID = authcid[strudelIndex+1:]
}
}
password := string(splitValue[2])
err := server.accounts.AuthenticateByPassphrase(client, authcid, password)
@ -294,6 +297,9 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
// distinguish user/ident from account name
if strudelIndex := strings.IndexByte(authzid, '@'); strudelIndex != -1 {
authzid = authzid[:strudelIndex]
if !client.registered {
rb.session.deviceID = authzid[strudelIndex+1:]
}
}
err = server.accounts.AuthenticateByCertFP(client, rb.session.certfp, authzid)
}