0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-29 00:03:45 +02:00

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

View file

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