mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-11-29 09:29:15 +03:00
commit
ec60839064
1 changed files with 6 additions and 2 deletions
|
@ -152,6 +152,9 @@ impl WSHandler {
|
||||||
impl Handler for WSHandler {
|
impl Handler for WSHandler {
|
||||||
fn on_open(&mut self, hs: Handshake) -> ws::Result<()> {
|
fn on_open(&mut self, hs: Handshake) -> ws::Result<()> {
|
||||||
// Path == "/notifications/hub?id=<id>==&access_token=<access_token>"
|
// Path == "/notifications/hub?id=<id>==&access_token=<access_token>"
|
||||||
|
//
|
||||||
|
// We don't use `id`, and as of around 2020-03-25, the official clients
|
||||||
|
// no longer seem to pass `id` (only `access_token`).
|
||||||
let path = hs.request.resource();
|
let path = hs.request.resource();
|
||||||
|
|
||||||
let (_id, access_token) = match path.split('?').nth(1) {
|
let (_id, access_token) = match path.split('?').nth(1) {
|
||||||
|
@ -170,10 +173,11 @@ impl Handler for WSHandler {
|
||||||
|
|
||||||
match (id, access_token) {
|
match (id, access_token) {
|
||||||
(Some(a), Some(b)) => (a, b),
|
(Some(a), Some(b)) => (a, b),
|
||||||
_ => return self.err("Missing id or access token"),
|
(None, Some(b)) => ("", b), // Ignore missing `id`.
|
||||||
|
_ => return self.err("Missing access token"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => return self.err("Missing query path"),
|
None => return self.err("Missing query parameters"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Validate the user
|
// Validate the user
|
||||||
|
|
Loading…
Reference in a new issue