mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
remove password field
This commit is contained in:
@@ -102,8 +102,8 @@ struct BreweryRecord {
|
|||||||
/**
|
/**
|
||||||
* @brief Helper struct to store generated user data.
|
* @brief Helper struct to store generated user data.
|
||||||
*
|
*
|
||||||
* `email`, `date_of_birth`, and `password` are programmatically generated by
|
* `email` and `date_of_birth` are programmatically generated by the
|
||||||
* the orchestrator (never LLM-authored) so a downstream auth-account seeding
|
* orchestrator (never LLM-authored) so a downstream auth-account seeding
|
||||||
* consumer can register real accounts from the pipeline's SQLite export.
|
* consumer can register real accounts from the pipeline's SQLite export.
|
||||||
*/
|
*/
|
||||||
struct UserRecord {
|
struct UserRecord {
|
||||||
@@ -111,7 +111,6 @@ struct UserRecord {
|
|||||||
UserResult user;
|
UserResult user;
|
||||||
std::string email{};
|
std::string email{};
|
||||||
std::string date_of_birth{};
|
std::string date_of_birth{};
|
||||||
std::string password{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_DATA_MODEL_GENERATED_MODELS_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_DATA_MODEL_GENERATED_MODELS_H_
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ CREATE TABLE IF NOT EXISTS users (
|
|||||||
activity_weight REAL NOT NULL,
|
activity_weight REAL NOT NULL,
|
||||||
email TEXT NOT NULL UNIQUE,
|
email TEXT NOT NULL UNIQUE,
|
||||||
date_of_birth TEXT NOT NULL,
|
date_of_birth TEXT NOT NULL,
|
||||||
password TEXT NOT NULL,
|
|
||||||
FOREIGN KEY(location_id) REFERENCES locations(id) ON DELETE CASCADE
|
FOREIGN KEY(location_id) REFERENCES locations(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -104,9 +103,8 @@ INSERT INTO users (
|
|||||||
bio,
|
bio,
|
||||||
activity_weight,
|
activity_weight,
|
||||||
email,
|
email,
|
||||||
date_of_birth,
|
date_of_birth
|
||||||
password
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
|
||||||
)sql";
|
)sql";
|
||||||
|
|
||||||
// sqlite3_bind_*() parameter indices are 1-based, matching the "?"
|
// sqlite3_bind_*() parameter indices are 1-based, matching the "?"
|
||||||
@@ -135,7 +133,6 @@ inline constexpr int kUserBioBindIndex = 6;
|
|||||||
inline constexpr int kUserActivityWeightBindIndex = 7;
|
inline constexpr int kUserActivityWeightBindIndex = 7;
|
||||||
inline constexpr int kUserEmailBindIndex = 8;
|
inline constexpr int kUserEmailBindIndex = 8;
|
||||||
inline constexpr int kUserDateOfBirthBindIndex = 9;
|
inline constexpr int kUserDateOfBirthBindIndex = 9;
|
||||||
inline constexpr int kUserPasswordBindIndex = 10;
|
|
||||||
|
|
||||||
SqliteStatementHandle PrepareStatement(const SqliteDatabaseHandle& db_handle,
|
SqliteStatementHandle PrepareStatement(const SqliteDatabaseHandle& db_handle,
|
||||||
std::string_view sql,
|
std::string_view sql,
|
||||||
|
|||||||
@@ -71,22 +71,6 @@ std::string GenerateDateOfBirth(std::mt19937& rng) {
|
|||||||
static_cast<unsigned>(birth_ymd.day()));
|
static_cast<unsigned>(birth_ymd.day()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GenerateRandomPassword(std::mt19937& rng) {
|
|
||||||
constexpr size_t k_password_length = 32;
|
|
||||||
constexpr std::string_view k_charset =
|
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&"
|
|
||||||
"*";
|
|
||||||
|
|
||||||
std::uniform_int_distribution<size_t> char_dist(0, k_charset.size() - 1);
|
|
||||||
|
|
||||||
std::string password;
|
|
||||||
password.reserve(k_password_length);
|
|
||||||
for (size_t i = 0; i < k_password_length; ++i) {
|
|
||||||
password.push_back(k_charset[char_dist(rng)]);
|
|
||||||
}
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void BiergartenPipelineOrchestrator::GenerateUsers(
|
void BiergartenPipelineOrchestrator::GenerateUsers(
|
||||||
@@ -128,7 +112,6 @@ void BiergartenPipelineOrchestrator::GenerateUsers(
|
|||||||
.user = user,
|
.user = user,
|
||||||
.email = BuildEmail(sampled_name, used_email_local_parts),
|
.email = BuildEmail(sampled_name, used_email_local_parts),
|
||||||
.date_of_birth = GenerateDateOfBirth(rng),
|
.date_of_birth = GenerateDateOfBirth(rng),
|
||||||
.password = GenerateRandomPassword(rng),
|
|
||||||
};
|
};
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
++skipped_count;
|
++skipped_count;
|
||||||
|
|||||||
@@ -69,12 +69,6 @@ uint64_t SqliteExportService::ProcessRecord(const UserRecord& user) {
|
|||||||
.index = sqlite_export_service_internal::kUserDateOfBirthBindIndex,
|
.index = sqlite_export_service_internal::kUserDateOfBirthBindIndex,
|
||||||
.value = user.date_of_birth,
|
.value = user.date_of_birth,
|
||||||
.action = "Failed to bind SQLite user date of birth"});
|
.action = "Failed to bind SQLite user date of birth"});
|
||||||
sqlite_export_service_internal::Bind(
|
|
||||||
insert_user_stmt_,
|
|
||||||
sqlite_export_service_internal::BindParam<std::string_view>{
|
|
||||||
.index = sqlite_export_service_internal::kUserPasswordBindIndex,
|
|
||||||
.value = user.password,
|
|
||||||
.action = "Failed to bind SQLite user password"});
|
|
||||||
|
|
||||||
sqlite_export_service_internal::StepStatement(
|
sqlite_export_service_internal::StepStatement(
|
||||||
db_handle_, insert_user_stmt_, "Failed to insert SQLite user row");
|
db_handle_, insert_user_stmt_, "Failed to insert SQLite user row");
|
||||||
|
|||||||
Reference in New Issue
Block a user