modules/console: Split user tokens clear into separate cmd.

This commit is contained in:
Jason Volk 2023-04-18 13:13:04 -07:00
parent 15cb6bfdca
commit 2122412c6d
1 changed files with 28 additions and 17 deletions

View File

@ -13941,7 +13941,7 @@ console_cmd__user__tokens(opt &out, const string_view &line)
{
const params param{line, " ",
{
"user_id", "clear"
"user_id"
}};
const m::user user
@ -13949,27 +13949,11 @@ console_cmd__user__tokens(opt &out, const string_view &line)
param.at("user_id")
};
const bool clear
{
param["clear"] == "clear"
};
const m::user::tokens tokens
{
user
};
if(clear)
{
const size_t count
{
tokens.del("Invalidated by administrator console.")
};
out << "Invalidated " << count << std::endl;
return true;
}
tokens.for_each([&out]
(const m::event::idx &event_idx, const string_view &token)
{
@ -14010,6 +13994,33 @@ console_cmd__user__tokens(opt &out, const string_view &line)
return true;
}
bool
console_cmd__user__tokens__clear(opt &out, const string_view &line)
{
const params param{line, " ",
{
"user_id"
}};
const m::user user
{
param.at("user_id")
};
const m::user::tokens tokens
{
user
};
const size_t count
{
tokens.del("Invalidated by administrator console.")
};
out << "Invalidated " << count << std::endl;
return true;
}
bool
console_cmd__user__profile(opt &out, const string_view &line)
{