From 67299595801c6844247b798eb62dfb33da0fb1a4 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Fri, 21 Feb 2020 15:19:59 +0800 Subject: [PATCH] change pw_cost to integer to match official impl --- migrations/2020-02-20-085623_create_user/up.sql | 2 +- src/api.rs | 2 +- src/schema.rs | 2 +- src/user.rs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/migrations/2020-02-20-085623_create_user/up.sql b/migrations/2020-02-20-085623_create_user/up.sql index e99bd4d..4dd58f9 100644 --- a/migrations/2020-02-20-085623_create_user/up.sql +++ b/migrations/2020-02-20-085623_create_user/up.sql @@ -2,7 +2,7 @@ CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, email VARCHAR NOT NULL, password VARCHAR NOT NULL, - pw_cost VARCHAR NOT NULL, + pw_cost INTEGER NOT NULL, pw_nonce VARCHAR NOT NULL, version VARCHAR NOT NULL ) \ No newline at end of file diff --git a/src/api.rs b/src/api.rs index da42dcc..b0d83fc 100644 --- a/src/api.rs +++ b/src/api.rs @@ -81,7 +81,7 @@ fn _sign_in(db: DbConn, mail: &str, passwd: &str) -> Custom #[derive(Serialize)] struct AuthParams { - pw_cost: String, + pw_cost: i32, pw_nonce: String, version: String } diff --git a/src/schema.rs b/src/schema.rs index 54739cb..21ef538 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -17,7 +17,7 @@ table! { id -> Integer, email -> Text, password -> Text, - pw_cost -> Text, + pw_cost -> Integer, pw_nonce -> Text, version -> Text, } diff --git a/src/user.rs b/src/user.rs index ce923ee..3c78a55 100644 --- a/src/user.rs +++ b/src/user.rs @@ -66,7 +66,7 @@ struct UserQuery { pub id: i32, pub email: String, pub password: String, - pub pw_cost: String, + pub pw_cost: i32, pub pw_nonce: String, pub version: String } @@ -91,7 +91,7 @@ pub struct User { pub id: i32, pub email: String, pub password: Password, - pub pw_cost: String, + pub pw_cost: i32, pub pw_nonce: String, pub version: String } @@ -101,7 +101,7 @@ pub struct User { pub struct NewUser { pub email: String, pub password: String, - pub pw_cost: String, + pub pw_cost: i32, pub pw_nonce: String, pub version: String }