diff --git a/VERSION b/VERSION index 0c9cb695..32bd932f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.11.2 \ No newline at end of file +1.12.0 \ No newline at end of file diff --git a/acp/package.json b/acp/package.json index e3c2b7f2..0e92cddc 100644 --- a/acp/package.json +++ b/acp/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.11.2", + "version": "1.12.0", "description": "", "main": "index.js", "scripts": { diff --git a/client/package.json b/client/package.json index 94c36086..f3b08026 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.11.2", + "version": "1.12.0", "description": "", "main": "index.js", "scripts": { diff --git a/client/src/components/account.top.jsx b/client/src/components/account.top.jsx index b2500d62..eb4acec0 100644 --- a/client/src/components/account.top.jsx +++ b/client/src/components/account.top.jsx @@ -19,8 +19,8 @@ const addState = connect( } = state; - function sendSetPassword(current, password) { - postData('/account/password', { current, password }) + function sendSetPassword(password) { + postData('/account/password', { password }) .then(res => res.json()) .then(data => { if (data.error) return errorToast(data.error); @@ -74,7 +74,7 @@ class AccountStatus extends Component { super(props); this.state = { - passwordState: { current: '', password: '', confirm: ''}, + passwordState: { password: '', confirm: ''}, emailState: null, unsubState: false, }; @@ -105,8 +105,8 @@ class AccountStatus extends Component { passwordState.password === passwordState.confirm; const setPasswordDisabled = () => { - const { current, password, confirm } = passwordState; - return !(passwordsEqual() && password && current && confirm); + const { password, confirm } = passwordState; + return !(passwordsEqual() && password && confirm); } const tlClick = e => { @@ -173,15 +173,7 @@ class AccountStatus extends Component {

Password

- - +
diff --git a/core/Cargo.toml b/core/Cargo.toml index f128fda1..4edb5c25 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml_core" -version = "1.11.2" +version = "1.12.0" authors = ["ntr ", "mashy "] [dependencies] diff --git a/core/src/game.rs b/core/src/game.rs index 42e14f8b..5364013b 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -104,7 +104,6 @@ impl Game { // let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::>().join(", "); // self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description)); - player.constructs.sort_unstable_by_key(|c| c.id); self.players.push(player); Ok(self) @@ -1201,7 +1200,7 @@ mod tests { .player_add(y_player).unwrap(); game = game.start(); - + assert!(game.players[0].constructs[0].skill_on_cd(Skill::Ruin).is_some()); assert!(game.players[1].constructs[0].skill_on_cd(Skill::Ruin).is_none()); } diff --git a/core/src/player.rs b/core/src/player.rs index 21556a0b..0b686a60 100644 --- a/core/src/player.rs +++ b/core/src/player.rs @@ -65,7 +65,9 @@ pub struct Player { } impl Player { - pub fn new(account: Uuid, img: Option, name: &String, constructs: Vec) -> Player { + pub fn new(account: Uuid, img: Option, name: &String, mut constructs: Vec) -> Player { + constructs.sort_unstable_by_key(|c| c.id); + Player { id: account, img, diff --git a/ops/package.json b/ops/package.json index 9a1ed953..3b993c63 100644 --- a/ops/package.json +++ b/ops/package.json @@ -1,6 +1,6 @@ { "name": "mnml-ops", - "version": "1.11.2", + "version": "1.12.0", "description": "", "main": "index.js", "scripts": { diff --git a/server/Cargo.toml b/server/Cargo.toml index 16ced6b7..9f7e199a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml" -version = "1.11.2" +version = "1.12.0" authors = ["ntr "] [dependencies] diff --git a/server/src/account.rs b/server/src/account.rs index 08d1ca74..f180cf70 100644 --- a/server/src/account.rs +++ b/server/src/account.rs @@ -213,42 +213,42 @@ pub fn new_img(tx: &mut Transaction, id: Uuid) -> Result { Account::try_from(row) } -pub fn set_password(tx: &mut Transaction, id: Uuid, current: &String, password: &String) -> Result { +pub fn set_password(tx: &mut Transaction, id: Uuid, password: &String) -> Result { if password.len() < PASSWORD_MIN_LEN || password.len() > 100 { return Err(MnmlHttpError::PasswordUnacceptable); } - let query = " - SELECT id, password - FROM accounts - WHERE id = $1 - "; + // let query = " + // SELECT id, password + // FROM accounts + // WHERE id = $1 + // "; - let result = tx - .query(query, &[&id])?; + // let result = tx + // .query(query, &[&id])?; - let row = match result.iter().next() { - Some(row) => row, - None => { - let mut rng = thread_rng(); - let garbage: String = iter::repeat(()) - .map(|()| rng.sample(Alphanumeric)) - .take(64) - .collect(); + // let row = match result.iter().next() { + // Some(row) => row, + // None => { + // let mut rng = thread_rng(); + // let garbage: String = iter::repeat(()) + // .map(|()| rng.sample(Alphanumeric)) + // .take(64) + // .collect(); - // verify garbage to prevent timing attacks - verify(garbage.clone(), &garbage).ok(); - return Err(MnmlHttpError::AccountNotFound); - }, - }; + // // verify garbage to prevent timing attacks + // verify(garbage.clone(), &garbage).ok(); + // return Err(MnmlHttpError::AccountNotFound); + // }, + // }; - let id: Uuid = row.get(0); - let db_pw: String = row.get(1); + // let id: Uuid = row.get(0); + // let db_pw: String = row.get(1); - // return bad request to prevent being logged out - if !verify(current, &db_pw)? { - return Err(MnmlHttpError::BadRequest); - } + // // return bad request to prevent being logged out + // if !verify(current, &db_pw)? { + // return Err(MnmlHttpError::BadRequest); + // } let password = hash(&password, PASSWORD_ROUNDS)?; diff --git a/server/src/http.rs b/server/src/http.rs index 88e7b51b..34b3b994 100644 --- a/server/src/http.rs +++ b/server/src/http.rs @@ -369,7 +369,7 @@ fn recover(req: &mut Request) -> IronResult { #[derive(Debug,Clone,Deserialize)] struct SetPassword { - current: String, + // current: String, password: String, } @@ -385,7 +385,7 @@ fn set_password(req: &mut Request) -> IronResult { let db = state.pool.get().or(Err(MnmlHttpError::DbError))?; let mut tx = db.transaction().or(Err(MnmlHttpError::DbError))?; - let token = account::set_password(&mut tx, a.id, ¶ms.current, ¶ms.password)?; + let token = account::set_password(&mut tx, a.id, ¶ms.password)?; tx.commit().or(Err(MnmlHttpError::ServerError))?; diff --git a/server/src/mail.rs b/server/src/mail.rs index d5083021..8f3b351f 100644 --- a/server/src/mail.rs +++ b/server/src/mail.rs @@ -42,10 +42,10 @@ pub enum Mail { fn recover(email: &String, name: &String, token: &String) -> SendableEmail { let body = format!("{:}, the link below will recover your account. -please change your password immediately in the account page. -this link will expire in 48 hours or once used. +please change your password immediately in the account page +as this link will expire in 48 hours or once used. -http://mnml.gg/api/account/recover?recover_token={:} +https://mnml.gg/api/account/recover?recover_token={:} glhf --mnml", name, token); @@ -63,7 +63,7 @@ glhf fn confirm(email: &String, name: &String, token: &String) -> SendableEmail { let confirm_body = format!("{:}, please click the link below to confirm your email -http://mnml.gg/api/account/email/confirm?confirm_token={:} +https://mnml.gg/api/account/email/confirm?confirm_token={:} glhf --mnml", name, token); diff --git a/studios/package.json b/studios/package.json index d7abb0fd..4d90c4c3 100644 --- a/studios/package.json +++ b/studios/package.json @@ -1,6 +1,6 @@ { "name": "mnml-studios", - "version": "1.11.2", + "version": "1.12.0", "description": "", "main": "index.js", "scripts": {