Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a command to expire all passwords #74

Merged
merged 15 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/api_commands/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct CreateAccount {
pub name: String,
pub username: String,
pub password: SecBytes,
}

#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct Login {
pub name: String,
pub username: String,
pub password: SecBytes,
}

Expand All @@ -23,7 +23,7 @@ mod tests {
#[test]
fn test_serde_create_account() {
let create_account = CreateAccount {
name: "anne".to_owned(),
username: "anne".to_owned(),
password: "frank".to_owned().into(),
};

Expand Down
41 changes: 21 additions & 20 deletions backend/integration-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async fn test_user_account_creation() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "anne".to_owned(),
username: "anne".to_owned(),
password: "frank😀😀😀".to_owned().into(),
},
)
Expand All @@ -93,7 +93,7 @@ async fn test_duplicate_user_account_creation() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "rosa".to_owned(),
username: "rosa".to_owned(),
password: "luxemburg".to_owned().into(),
},
)
Expand All @@ -105,7 +105,7 @@ async fn test_duplicate_user_account_creation() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "rosa".to_owned(),
username: "rosa".to_owned(),
password: "luxemburg".to_owned().into(),
},
)
Expand All @@ -120,7 +120,7 @@ async fn test_user_account_deletion() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "claus".to_owned(),
username: "claus".to_owned(),
password: "von stauffenberg".to_owned().into(),
},
)
Expand All @@ -136,7 +136,7 @@ async fn test_user_account_deletion() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "claus".to_owned(),
username: "claus".to_owned(),
password: "von stauffenberg".to_owned().into(),
},
)
Expand All @@ -157,7 +157,7 @@ async fn test_login_logout() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "orli".to_owned(),
username: "orli".to_owned(),
password: password.clone(),
},
)
Expand All @@ -173,7 +173,7 @@ async fn test_login_logout() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "orli".to_owned(),
username: "orli".to_owned(),
password: password.clone(),
},
)
Expand All @@ -196,7 +196,7 @@ async fn test_wrong_password() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "lothar".to_owned(),
username: "lothar".to_owned(),
password: "kreyssig".to_owned().into(),
},
)
Expand All @@ -209,7 +209,7 @@ async fn test_wrong_password() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "lothar".to_owned(),
username: "lothar".to_owned(),
password: "anders++".to_owned().into(),
},
)
Expand All @@ -222,7 +222,7 @@ async fn test_wrong_password() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "lothar".to_owned(),
username: "lothar".to_owned(),
password: "kreyssig".to_owned().into(),
},
)
Expand All @@ -235,7 +235,7 @@ async fn test_wrong_password() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "lothar".to_owned(),
username: "lothar".to_owned(),
password: "anders".to_owned().into(),
},
)
Expand All @@ -252,7 +252,7 @@ async fn test_wrong_password() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "lothar".to_owned(),
username: "lothar".to_owned(),
password: "kreyssig".to_owned().into(),
},
)
Expand All @@ -275,8 +275,9 @@ async fn test_too_long_username() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "else-else-else-else-else-else-else-else-else-else-else-else-else-else-else"
.to_owned(),
username:
"else-else-else-else-else-else-else-else-else-else-else-else-else-else-else"
.to_owned(),
password: "hirsch😀😀".to_owned().into(),
},
)
Expand All @@ -291,7 +292,7 @@ async fn test_too_long_password() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "josef"
username: "josef"
.to_owned(),
password: "höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn-höhn".to_owned().into(),
},
Expand All @@ -307,7 +308,7 @@ async fn test_too_short_username() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "K.".to_owned(),
username: "K.".to_owned(),
password: "ibach😀😀😀".to_owned().into(),
},
)
Expand All @@ -322,7 +323,7 @@ async fn test_too_short_password() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "hans".to_owned(),
username: "hans".to_owned(),
password: "ils".to_owned().into(),
},
)
Expand All @@ -337,7 +338,7 @@ async fn test_wrong_username_login() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "peter".to_owned(),
username: "peter".to_owned(),
password: "hüppeler".to_owned().into(),
},
)
Expand All @@ -352,7 +353,7 @@ async fn test_too_long_password_login() -> anyhow::Result<()> {
.post(
"/accounts/create",
CreateAccount {
name: "alois".to_owned(),
username: "alois".to_owned(),
password: "hundhammer".to_owned().into(),
},
)
Expand All @@ -364,7 +365,7 @@ async fn test_too_long_password_login() -> anyhow::Result<()> {
.post(
"/accounts/login",
Login {
name: "alois".to_owned(),
username: "alois".to_owned(),
password: "hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer-hundhammer".to_owned().into(),
},
)
Expand Down
4 changes: 3 additions & 1 deletion backend/rvoc-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ edition.workspace = true
rust-version.workspace = true
publish = false

default-run = "rvoc-backend"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
Expand All @@ -31,7 +33,7 @@ opentelemetry-otlp = { version = "0.13.0" }
thiserror = "1.0.50"

# database
diesel = { version = "2.1.0", features = ["postgres", "chrono"] }
diesel = { version = "2.1.3", features = ["postgres", "chrono"] }
diesel_migrations = "2.1.0"
diesel-async = { version = "0.4.1", features = ["postgres", "deadpool"] }

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE users ADD COLUMN password_hash TEXT NOT NULL;
ALTER TABLE users ADD COLUMN password_hash TEXT;
Loading
Loading