|
|
@ -15,20 +15,50 @@ use mio::tcp::TcpListener; |
|
|
|
use mio::{Events, Poll, Token, Ready, PollOpt};
|
|
|
|
//use dotenv::dotenv;
|
|
|
|
|
|
|
|
use bcrypt;
|
|
|
|
//use diesel::r2d2;
|
|
|
|
//use diesel::prelude::*;
|
|
|
|
//use diesel::pg::PgConnection;
|
|
|
|
|
|
|
|
use libpso::character::settings;
|
|
|
|
|
|
|
|
//use models::{NewUser, UserAccount, UserSettings, NewUserSettings};
|
|
|
|
//use dataaccess::DBAccess;
|
|
|
|
use entities::{UserAccount, UserSettings};
|
|
|
|
use dataaccess::DataAccess;
|
|
|
|
|
|
|
|
use std::time::SystemTime;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
struct LoginStubData {
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DataAccess for LoginStubData {
|
|
|
|
fn get_user_by_name(&self, username: String) -> Option<UserAccount> {
|
|
|
|
if username.as_str() == "hi" {
|
|
|
|
Some(UserAccount {
|
|
|
|
id: 1,
|
|
|
|
username: "hi".to_owned(),
|
|
|
|
password: bcrypt::hash("qwer", 5).unwrap(),
|
|
|
|
guildcard: None,
|
|
|
|
team_id: None,
|
|
|
|
banned: false,
|
|
|
|
muted_until: SystemTime::now(),
|
|
|
|
created_at: SystemTime::now(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_user_settings_by_user(&self, user: &UserAccount) -> Option<UserSettings> {
|
|
|
|
Some(UserSettings {
|
|
|
|
id: 0,
|
|
|
|
user_id: user.id,
|
|
|
|
settings: settings::UserSettings::default()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|