Skip to content

Commit

Permalink
Start using rustfmt and some style changes to make some lines shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Dec 30, 2018
1 parent 72ed05c commit 30e7686
Show file tree
Hide file tree
Showing 26 changed files with 1,177 additions and 903 deletions.
1 change: 1 addition & 0 deletions rustfmt.toml
@@ -0,0 +1 @@
max_width = 120
22 changes: 15 additions & 7 deletions src/api/core/accounts.rs
Expand Up @@ -3,13 +3,13 @@ use rocket_contrib::json::Json;
use crate::db::models::*;
use crate::db::DbConn;

use crate::api::{EmptyResult, JsonResult, JsonUpcase, NumberOrString, PasswordData, UpdateType, WebSocketUsers};
use crate::auth::{Headers, decode_invite_jwt, InviteJWTClaims};
use crate::api::{EmptyResult, JsonResult, JsonUpcase, Notify, NumberOrString, PasswordData, UpdateType};
use crate::auth::{decode_invite_jwt, Headers, InviteJWTClaims};
use crate::mail;

use crate::CONFIG;

use rocket::{Route, State};
use rocket::Route;

pub fn routes() -> Vec<Route> {
routes![
Expand Down Expand Up @@ -74,9 +74,9 @@ fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> EmptyResult {
} else {
let token = match &data.Token {
Some(token) => token,
None => err!("No valid invite token")
None => err!("No valid invite token"),
};

let claims: InviteJWTClaims = decode_invite_jwt(&token)?;
if &claims.email == &data.Email {
user
Expand Down Expand Up @@ -257,7 +257,7 @@ struct KeyData {
}

#[post("/accounts/key", data = "<data>")]
fn post_rotatekey(data: JsonUpcase<KeyData>, headers: Headers, conn: DbConn, ws: State<WebSocketUsers>) -> EmptyResult {
fn post_rotatekey(data: JsonUpcase<KeyData>, headers: Headers, conn: DbConn, nt: Notify) -> EmptyResult {
let data: KeyData = data.into_inner().data;

if !headers.user.check_valid_password(&data.MasterPasswordHash) {
Expand Down Expand Up @@ -294,7 +294,15 @@ fn post_rotatekey(data: JsonUpcase<KeyData>, headers: Headers, conn: DbConn, ws:
err!("The cipher is not owned by the user")
}

update_cipher_from_data(&mut saved_cipher, cipher_data, &headers, false, &conn, &ws, UpdateType::SyncCipherUpdate)?
update_cipher_from_data(
&mut saved_cipher,
cipher_data,
&headers,
false,
&conn,
&nt,
UpdateType::CipherUpdate,
)?
}

// Update user data
Expand Down

0 comments on commit 30e7686

Please sign in to comment.