fix disconnect bug"

This commit is contained in:
ntr 2020-01-14 10:09:19 +10:00
parent e7e8e39acb
commit c42d895e59
2 changed files with 5 additions and 2 deletions

View File

@ -18,7 +18,7 @@ use mnml_core::player::{Player};
use http::MnmlHttpError; use http::MnmlHttpError;
use names::{name as generate_name}; use names::{name as generate_name};
use mtx::{Mtx, FREE_MTX}; use mtx::{Mtx, FREE_MTX};
use pg::{Db, instance_delete, construct_spawn, instance_practice}; use pg::{Db, instance_delete, construct_spawn};
use img; use img;
static PASSWORD_MIN_LEN: usize = 3; static PASSWORD_MIN_LEN: usize = 3;

View File

@ -198,7 +198,10 @@ impl Handler for Connection {
if cookie.name() == TOKEN_HEADER { if cookie.name() == TOKEN_HEADER {
let db = self.pool.get().unwrap(); let db = self.pool.get().unwrap();
match account::from_token(&db, &cookie.value().to_string()) { match account::from_token(&db, &cookie.value().to_string()) {
Ok(a) => self.user = Box::new(Authenticated::new(a, self.ws.clone(), self.events.clone(), self.pool.clone())), Ok(a) => {
self.id = a.id;
self.user = Box::new(Authenticated::new(a, self.ws.clone(), self.events.clone(), self.pool.clone()));
},
Err(_) => return unauth(), Err(_) => return unauth(),
} }
} }