From 2be1dafe80e4359da257cf816ef9b24e69ee3e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 1 Jun 2018 00:35:30 +0200 Subject: [PATCH] Missed some --- src/api/core/accounts.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs index 5083d00e..c89acd2f 100644 --- a/src/api/core/accounts.rs +++ b/src/api/core/accounts.rs @@ -6,6 +6,8 @@ use db::models::*; use api::{PasswordData, JsonResult, EmptyResult, JsonUpcase}; use auth::Headers; +use util; + use CONFIG; #[derive(Deserialize, Debug)] @@ -13,6 +15,7 @@ use CONFIG; struct RegisterData { Email: String, Key: String, + #[serde(deserialize_with = "util::upcase_deserialize")] Keys: Option, MasterPasswordHash: String, MasterPasswordHint: Option, @@ -22,8 +25,8 @@ struct RegisterData { #[derive(Deserialize, Debug)] #[allow(non_snake_case)] struct KeysData { - encryptedPrivateKey: String, - publicKey: String, + EncryptedPrivateKey: String, + PublicKey: String, } #[post("/accounts/register", data = "")] @@ -50,8 +53,8 @@ fn register(data: JsonUpcase, conn: DbConn) -> EmptyResult { } if let Some(keys) = data.Keys { - user.private_key = Some(keys.encryptedPrivateKey); - user.public_key = Some(keys.publicKey); + user.private_key = Some(keys.EncryptedPrivateKey); + user.public_key = Some(keys.PublicKey); } user.save(&conn); @@ -84,8 +87,8 @@ fn post_keys(data: JsonUpcase, headers: Headers, conn: DbConn) -> Json let mut user = headers.user; - user.private_key = Some(data.encryptedPrivateKey); - user.public_key = Some(data.publicKey); + user.private_key = Some(data.EncryptedPrivateKey); + user.public_key = Some(data.PublicKey); user.save(&conn);