4using System.Threading.Tasks;
18 : base(
"/RequestAccount")
22 public override bool HandlesSubPaths =>
false;
23 public override bool UserSessions =>
true;
35 if (Content.
HasError || !(Content.
Decoded is Dictionary<string, string> Form))
48 string RecaptchaResponse;
50 if (!Form.ContainsKey(
"Name") ||
string.IsNullOrEmpty(Name = Form[
"Name"]))
62 if (!Form.ContainsKey(
"LinkedIn") ||
string.IsNullOrEmpty(LinkedIn = Form[
"LinkedIn"]))
68 if (!Form.ContainsKey(
"Organization") ||
string.IsNullOrEmpty(Organization = Form[
"Organization"]))
74 if (!Form.ContainsKey(
"Where") ||
string.IsNullOrEmpty(Where = Form[
"Where"]))
80 if (!Form.ContainsKey(
"TimeLimit") ||
string.IsNullOrEmpty(TimeLimit = Form[
"TimeLimit"]))
81 TimeLimit =
string.Empty;
83 if (!Form.ContainsKey(
"Text") ||
string.IsNullOrEmpty(Text = Form[
"Text"]))
89 if (!Form.ContainsKey(
"g-recaptcha-response") ||
string.IsNullOrEmpty(RecaptchaResponse = Form[
"g-recaptcha-response"]))
98 new KeyValuePair<string, object>(
"Name", Name),
99 new KeyValuePair<string, object>(
"EMail", EMail.
Value),
100 new KeyValuePair<string, object>(
"LinkedIn", LinkedIn),
101 new KeyValuePair<string, object>(
"Organization", Organization),
102 new KeyValuePair<string, object>(
"Where", Where),
103 new KeyValuePair<string, object>(
"TimeLimit", TimeLimit),
104 new KeyValuePair<string, object>(
"Text", Text),
105 new KeyValuePair<string, object>(
"RemoteEndPoint", Request.
RemoteEndPoint));
107 Dictionary<string, object>
Feedback =
new Dictionary<string, object>();
108 foreach (KeyValuePair<string, object> P
in Tags)
113 StringBuilder Markdown =
new StringBuilder();
114 DateTime Now = DateTime.Now;
116 Markdown.AppendLine(
"Account requested.");
117 Markdown.AppendLine();
119 Markdown.AppendLine(
"| Account request ||");
120 Markdown.AppendLine(
"|:------|:-------|");
122 Markdown.Append(
"| Name: | ");
124 Markdown.AppendLine(
" |");
126 Markdown.Append(
"| e-Mail: | <a href=\"mailto:");
127 Markdown.Append(EMail.
Replace(
"\"",
"""));
128 Markdown.Append(
"\" target=\"_blank\">");
130 Markdown.AppendLine(
"</a> |");
132 Markdown.Append(
"| LinkedIn: | <a href=\"");
133 Markdown.Append(LinkedIn.Replace(
"\"",
"""));
134 Markdown.Append(
"\" target=\"_blank\">");
136 Markdown.AppendLine(
"</a> |");
138 Markdown.Append(
"| Organization: | ");
140 Markdown.AppendLine(
" |");
142 Markdown.Append(
"| Where: | ");
144 Markdown.AppendLine(
" |");
146 Markdown.Append(
"| Time Limit: | ");
148 Markdown.AppendLine(
" |");
152 Markdown.Append(
"| Date | ");
154 Markdown.AppendLine(
" |");
155 Markdown.Append(
"| Time | ");
157 Markdown.AppendLine(
" |");
159 Markdown.AppendLine();
160 Markdown.AppendLine();
161 Markdown.AppendLine(
"```");
162 Markdown.AppendLine(Text.Replace(
"```",
" ` ` ` "));
163 Markdown.AppendLine(
"```");
168 await IoTGateway.Gateway.SendNotification(Markdown.ToString());
Contains information about a response to a content request.
bool HasError
If an error occurred.
object Decoded
Decoded object.
Contains a markdown document. This markdown document class supports original markdown,...
static string Encode(string s)
Encodes all special characters in a string so that it can be included in a markdown document without ...
Static class managing the application event log. Applications and services log events on this static ...
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Represents an HTTP request.
string RemoteEndPoint
Remote end-point.
bool HasData
If the request has data.
SessionVariables Session
Contains session states, if the resource requires sessions, or null otherwise.
async Task< ContentResponse > DecodeDataAsync()
Decodes data sent in request.
Represets a response of an HTTP client request.
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
The response to the request can be found under a different URI and SHOULD be retrieved using a GET me...
Represents a case-insensitive string.
string Value
String-representation of the case-insensitive string. (Representation is case sensitive....
static bool IsNullOrEmpty(CaseInsensitiveString value)
Indicates whether the specified string is null or an CaseInsensitiveString.Empty string.
CaseInsensitiveString Replace(CaseInsensitiveString oldValue, CaseInsensitiveString newValue)
Returns a new string in which all occurrences of a specified string in the current instance are repla...
Class that monitors login events, and help applications determine malicious intent....
static async Task< string > AppendWhoIsInfo(StringBuilder Markdown, string RemoteEndPoint)
Appends WHOIS information to a Markdown document.
static async Task< KeyValuePair< string, object >[]> Annotate(string RemoteEndPoint, params KeyValuePair< string, object >[] Tags)
Annotates a remote endpoint.
Provides the user with options to control notifications from the Broker.
static BrokerNotificationConfiguration Instance
Current instance of configuration.
bool AccountRequested
If a notification should be sent when an account has been requested.
static async Task< bool > SiteVerify(string RecaptchaResponse, string RemoteEndPoint)
Allows web pages and web services to verify that Google reCaptcha responses are valid.
bool AllowsPOST
If the POST method is allowed.
async Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
Service Module hosting the XMPP broker and its components.
static async Task AppendRemoteEndPointToTable(StringBuilder Markdown, string RemoteEndPoint)
Appends annotated information about a remote endpoint to a Markdown table.
POST Interface for HTTP resources.