Updating name (#4)
Release Tagging / release (push) Failing after 1m40s
soaricarus_auth Build / Rustfmt (push) Successful in 52s
soaricarus_auth Build / Check (push) Successful in 2m5s
soaricarus_auth Build / Clippy (push) Successful in 2m48s
soaricarus_auth Build / build (push) Successful in 3m12s
soaricarus_auth Build / Test Suite (push) Successful in 4m35s
Release Tagging / release (push) Failing after 1m40s
soaricarus_auth Build / Rustfmt (push) Successful in 52s
soaricarus_auth Build / Check (push) Successful in 2m5s
soaricarus_auth Build / Clippy (push) Successful in 2m48s
soaricarus_auth Build / build (push) Successful in 3m12s
soaricarus_auth Build / Test Suite (push) Successful in 4m35s
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
+12
-12
@@ -28,14 +28,14 @@ pub mod response {
|
||||
#[derive(Default, Deserialize, Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
||||
pub data: Vec<simodels::login_result::LoginResult>,
|
||||
}
|
||||
|
||||
pub mod service_login {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
||||
pub data: Vec<simodels::login_result::LoginResult>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ pub mod response {
|
||||
#[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::login_result::LoginResult>,
|
||||
pub data: Vec<simodels::login_result::LoginResult>,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ pub mod endpoint {
|
||||
Ok(user) => {
|
||||
if hashing::verify_password(&payload.password, user.password.clone()).unwrap() {
|
||||
// Create token
|
||||
let key = icarus_envy::environment::get_secret_key().value;
|
||||
let key = sienvy::environment::get_secret_key().value;
|
||||
let (token_literal, duration) =
|
||||
token_stuff::create_token(&key, &user.id).unwrap();
|
||||
|
||||
@@ -104,11 +104,11 @@ pub mod endpoint {
|
||||
StatusCode::OK,
|
||||
Json(response::Response {
|
||||
message: String::from("Successful"),
|
||||
data: vec![icarus_models::login_result::LoginResult {
|
||||
data: vec![simodels::login_result::LoginResult {
|
||||
id: user.id,
|
||||
username: user.username.clone(),
|
||||
token: token_literal,
|
||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
||||
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||
expiration: duration,
|
||||
}],
|
||||
}),
|
||||
@@ -151,16 +151,16 @@ pub mod endpoint {
|
||||
|
||||
match repo::service::valid_passphrase(&pool, &payload.passphrase).await {
|
||||
Ok((id, username, _date_created)) => {
|
||||
let key = icarus_envy::environment::get_secret_key().value;
|
||||
let key = sienvy::environment::get_secret_key().value;
|
||||
let (token_literal, duration) =
|
||||
token_stuff::create_service_token(&key, &id).unwrap();
|
||||
|
||||
if token_stuff::verify_token(&key, &token_literal) {
|
||||
let login_result = icarus_models::login_result::LoginResult {
|
||||
let login_result = simodels::login_result::LoginResult {
|
||||
id,
|
||||
username,
|
||||
token: token_literal,
|
||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
||||
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||
expiration: duration,
|
||||
};
|
||||
|
||||
@@ -203,7 +203,7 @@ pub mod endpoint {
|
||||
axum::Json<response::refresh_token::Response>,
|
||||
) {
|
||||
let mut response = response::refresh_token::Response::default();
|
||||
let key = icarus_envy::environment::get_secret_key().value;
|
||||
let key = sienvy::environment::get_secret_key().value;
|
||||
|
||||
if token_stuff::verify_token(&key, &payload.access_token) {
|
||||
let token_type = token_stuff::get_token_type(&key, &payload.access_token).unwrap();
|
||||
@@ -215,11 +215,11 @@ pub mod endpoint {
|
||||
Ok((username, _, _)) => {
|
||||
match token_stuff::create_service_refresh_token(&key, &id) {
|
||||
Ok((access_token, exp_dur)) => {
|
||||
let login_result = icarus_models::login_result::LoginResult {
|
||||
let login_result = simodels::login_result::LoginResult {
|
||||
id,
|
||||
token: access_token,
|
||||
expiration: exp_dur,
|
||||
token_type: String::from(icarus_models::token::TOKEN_TYPE),
|
||||
token_type: String::from(simodels::token::TOKEN_TYPE),
|
||||
username,
|
||||
};
|
||||
response.message = String::from("Successful");
|
||||
|
||||
@@ -29,7 +29,7 @@ pub mod response {
|
||||
#[derive(Deserialize, Serialize, utoipa::ToSchema)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
pub data: Vec<icarus_models::user::User>,
|
||||
pub data: Vec<simodels::user::User>,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ pub async fn register_user(
|
||||
};
|
||||
|
||||
if registration_enabled {
|
||||
let mut user = icarus_models::user::User {
|
||||
let mut user = simodels::user::User {
|
||||
username: payload.username.clone(),
|
||||
password: payload.password.clone(),
|
||||
email: payload.email.clone(),
|
||||
@@ -91,7 +91,7 @@ pub async fn register_user(
|
||||
)
|
||||
} else {
|
||||
let salt_string = hashing::generate_salt().unwrap();
|
||||
let mut salt = icarus_models::user::salt::Salt::default();
|
||||
let mut salt = simodels::user::salt::Salt::default();
|
||||
let generated_salt = salt_string;
|
||||
salt.salt = generated_salt.to_string();
|
||||
salt.id = repo::salt::insert(&pool, &salt).await.unwrap();
|
||||
@@ -144,7 +144,7 @@ pub async fn register_user(
|
||||
/// Checks to see if registration is enabled
|
||||
async fn is_registration_enabled() -> Result<bool, std::io::Error> {
|
||||
let key = String::from("ENABLE_REGISTRATION");
|
||||
let var = icarus_envy::environment::get_env(&key);
|
||||
let var = sienvy::environment::get_env(&key);
|
||||
let parsed_value = var.value.to_uppercase();
|
||||
|
||||
if parsed_value == "TRUE" {
|
||||
|
||||
Reference in New Issue
Block a user