refactor(db): removed the not needed field `salt` from Accounts table
The password salt is already defined in the PHC string in the `password` filed
This commit is contained in:
parent
4910cfc133
commit
f9595513e0
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
All API endpoints are accessible with this base URL: `https://api.nerdcult.net/`.
|
All API endpoints are accessible with this base URL: `https://api.nerdcult.net/`.
|
||||||
Some API endpoints require an Authorization HTTP header.
|
Some API endpoints require an Authorization HTTP header.
|
||||||
The token for this can be aquired using the `/account/authenticate` endpoint.
|
The token for this can be acquired using the `/account/authenticate` endpoint.
|
||||||
|
|
||||||
## Implementation Status
|
## Implementation Status
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ pub struct Account {
|
||||||
pub id: ID,
|
pub id: ID,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub email: String,
|
pub email: String,
|
||||||
pub salt: String,
|
|
||||||
pub password: String,
|
pub password: String,
|
||||||
pub joined: sqlx_chrono::NaiveDateTime,
|
pub joined: sqlx_chrono::NaiveDateTime,
|
||||||
pub verified: bool,
|
pub verified: bool,
|
||||||
|
@ -80,10 +79,9 @@ impl Account {
|
||||||
let joined = sqlx_chrono::Utc::now().naive_utc();
|
let joined = sqlx_chrono::Utc::now().naive_utc();
|
||||||
|
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
r#"INSERT INTO Accounts (username, email, salt, password, joined, verified, flags) VALUES ($1, $2, $3, $4, $5, false, 0);"#,
|
r#"INSERT INTO Accounts (username, email, password, joined, verified, flags) VALUES ($1, $2, $3, $4, false, 0);"#,
|
||||||
username,
|
username,
|
||||||
email_hash,
|
email_hash,
|
||||||
salt.to_string(),
|
|
||||||
password_hash,
|
password_hash,
|
||||||
joined,
|
joined,
|
||||||
)
|
)
|
||||||
|
@ -105,7 +103,6 @@ impl Account {
|
||||||
id,
|
id,
|
||||||
username,
|
username,
|
||||||
email,
|
email,
|
||||||
salt,
|
|
||||||
password,
|
password,
|
||||||
joined,
|
joined,
|
||||||
verified as "verified!: bool",
|
verified as "verified!: bool",
|
||||||
|
@ -131,7 +128,6 @@ impl Account {
|
||||||
id,
|
id,
|
||||||
username,
|
username,
|
||||||
email,
|
email,
|
||||||
salt,
|
|
||||||
password,
|
password,
|
||||||
joined,
|
joined,
|
||||||
verified as "verified!: bool",
|
verified as "verified!: bool",
|
||||||
|
@ -163,7 +159,6 @@ impl Account {
|
||||||
id,
|
id,
|
||||||
username,
|
username,
|
||||||
email,
|
email,
|
||||||
salt,
|
|
||||||
password,
|
password,
|
||||||
joined,
|
joined,
|
||||||
verified as "verified!: bool",
|
verified as "verified!: bool",
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub enum RegisterConflict {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "conflict", rename_all = "snake_case")]
|
#[serde(tag = "problem", rename_all = "snake_case")]
|
||||||
pub enum RegisterUnprocessable {
|
pub enum RegisterUnprocessable {
|
||||||
Email,
|
Email,
|
||||||
Password,
|
Password,
|
||||||
|
|
|
@ -19,7 +19,6 @@ pub async fn start(port: u16, pool: PgPool) -> Result<()> {
|
||||||
id SERIAL8 NOT NULL,
|
id SERIAL8 NOT NULL,
|
||||||
username VARCHAR(32) NOT NULL,
|
username VARCHAR(32) NOT NULL,
|
||||||
email VARCHAR(44) NOT NULL,
|
email VARCHAR(44) NOT NULL,
|
||||||
salt VARCHAR(22) NOT NULL,
|
|
||||||
password VARCHAR(128) NOT NULL,
|
password VARCHAR(128) NOT NULL,
|
||||||
joined TIMESTAMP NOT NULL,
|
joined TIMESTAMP NOT NULL,
|
||||||
verified BOOLEAN NOT NULL,
|
verified BOOLEAN NOT NULL,
|
||||||
|
|
Loading…
Reference in New Issue