mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 19:11:06 +00:00
fix: password reset when portfolio not submitted
This commit is contained in:
parent
c402d6f4b9
commit
dd456a7870
1 changed files with 8 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ use sea_orm::{DbConn, prelude::Uuid, IntoActiveModel};
|
||||||
|
|
||||||
use crate::{error::ServiceError, Query, utils::db::get_recipients, models::candidate_details::EncryptedApplicationDetails, models::{candidate::{ApplicationDetails, CreateCandidateResponse}, candidate_details::{EncryptedString, EncryptedCandidateDetails}, auth::AuthenticableTrait, application::ApplicationResponse}, Mutation, crypto::{hash_password, self}};
|
use crate::{error::ServiceError, Query, utils::db::get_recipients, models::candidate_details::EncryptedApplicationDetails, models::{candidate::{ApplicationDetails, CreateCandidateResponse}, candidate_details::{EncryptedString, EncryptedCandidateDetails}, auth::AuthenticableTrait, application::ApplicationResponse}, Mutation, crypto::{hash_password, self}};
|
||||||
|
|
||||||
use super::{parent_service::ParentService, candidate_service::CandidateService, session_service::SessionService, portfolio_service::PortfolioService};
|
use super::{parent_service::ParentService, candidate_service::CandidateService, session_service::SessionService, portfolio_service::{PortfolioService, SubmissionProgress}};
|
||||||
|
|
||||||
const FIELD_OF_STUDY_PREFIXES: [&str; 3] = ["101", "102", "103"];
|
const FIELD_OF_STUDY_PREFIXES: [&str; 3] = ["101", "102", "103"];
|
||||||
|
|
||||||
|
|
@ -334,11 +334,13 @@ impl ApplicationService {
|
||||||
&admin_private_key
|
&admin_private_key
|
||||||
).await?;
|
).await?;
|
||||||
|
|
||||||
PortfolioService::reencrypt_portfolio(
|
if PortfolioService::get_submission_progress(candidate.id).await? == SubmissionProgress::Submitted {
|
||||||
candidate.id,
|
PortfolioService::reencrypt_portfolio(
|
||||||
admin_private_key,
|
candidate.id,
|
||||||
&recipients
|
admin_private_key,
|
||||||
).await?;
|
&recipients
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(
|
Ok(
|
||||||
CreateCandidateResponse {
|
CreateCandidateResponse {
|
||||||
|
|
@ -477,7 +479,6 @@ mod application_tests {
|
||||||
assert!(!ApplicationService::is_application_id_valid(101));
|
assert!(!ApplicationService::is_application_id_valid(101));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_password_reset() {
|
async fn test_password_reset() {
|
||||||
let db = get_memory_sqlite_connection().await;
|
let db = get_memory_sqlite_connection().await;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue