2using System.Text.RegularExpressions;
3using System.Threading.Tasks;
21 : base(
@"^reset\s+password\s+(?'Name'[^\s]+)$")
28 public override string Name =>
"Reset";
38 public override async Task
Execute(
ChatState State,
string[] Arguments,
string OrgMessage, Match Details,
41 string Name = Details.Groups[
"Name"].Value;
44 ??
throw new Exception(
"User not found.");
47 ??
throw new Exception(
"User not editable.");
50 await ResponseCallback(
"Generating password: `" + Password +
"`",
string.Empty);
54 await Persistence.Database.Update(
User);
60 await ResponseCallback(
"User updated: `" +
Name +
"`",
string.Empty);
71 new HelpItem(
"reset password NAME",
"Resets the password of an existing user with user name `NAME`.")
Static class that does BASE64URL encoding (using URL and filename safe alphabet), as defined in RFC46...
static string Encode(byte[] Data)
Converts a binary block of data to a Base64URL-encoded string.
Static class managing the application event log. Applications and services log events on this static ...
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Static class managing the runtime environment of the IoT Gateway.
static byte[] NextBytes(int NrBytes)
Generates an array of random bytes.
Corresponds to a user in the system.
Maintains the collection of all users in the system.
static byte[] ComputeHash(string UserName, string Password)
Computes a hash of a password.
static async Task< User > GetUser(string UserName, bool CreateIfNew)
Gets the User object corresponding to a User Name.
static void ClearCache()
Clears internal caches.
An administrative command whose syntax is validated with a regular expression.
Contains an item of information about a command.
Resets the password of a user.
override string Name
Command name
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
override HelpItem[] GetHelp()
Gets help about the command.
ResetPassword()
Resets the password of a user.
Basic interface for a user.
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.