refractor(auth): removed password from everywhere

This commit is contained in:
gabdevele
2026-06-16 10:37:31 +02:00 Unverified
parent 4f80d7f995
commit bb7ed18539
25 changed files with 69 additions and 454 deletions
+1 -7
View File
@@ -45,7 +45,7 @@ std::optional<UserContext> authenticate(const drogon::HttpRequestPtr &request)
auto db = drogon::app().getDbClient();
const auto userResult = db->execSqlSync(
"SELECT u.id, u.email, u.must_change_password "
"SELECT u.id, u.email "
"FROM api_tokens t "
"JOIN users u ON u.id = t.user_id "
"WHERE t.token_hash = ? AND t.revoked_at IS NULL "
@@ -93,7 +93,6 @@ std::optional<UserContext> authenticate(const drogon::HttpRequestPtr &request)
context.roles = std::move(roles);
context.permissions = std::move(permissions);
context.role = primaryRole(context.roles);
context.mustChangePassword = userResult[0]["must_change_password"].as<bool>();
return context;
}
@@ -122,9 +121,4 @@ bool isAdmin(const UserContext &user)
{
return hasRole(user, "admin") || hasPermission(user, "admin.manage");
}
bool mustChangePassword(const UserContext &user)
{
return user.mustChangePassword;
}
} // namespace visione::auth