Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var orchestrations = new OrchestrationEntity().FetchAll();
            var sb             = new StringBuilder();

            foreach (var orchestration in orchestrations)
            {
                var cl = clientFactory.CreateClient();

                var statusRequest = new HttpRequestMessage(HttpMethod.Get, orchestration.StatusQueryGetUri);
                var statusResult  = await cl.SendAsync(statusRequest);

                var status = OrchestrationStatus.FromJson(await statusResult.Content.ReadAsStringAsync());

                var reg = new RegistrationEntity().Fetch(status.name, status.instanceId);

                sb.Append($"<tr>");
                sb.Append($"<td>{reg?.UserName ?? "unknown"}</td>");
                sb.Append($"<td>{reg?.UserEmail ?? "unknown"}</td>");
                sb.Append($"<td>{HasVerified(reg?.EmailLastVerified ?? TableEntityBase.MinDate, "EmailVerified", orchestration)}</td>");
                sb.Append($"<td>{reg?.UserPhone ?? "unknown"}</td>");
                sb.Append($"<td>{HasVerified(reg?.PhoneLastVerified ?? TableEntityBase.MinDate, "SmsVerified", orchestration)}</td>");
                sb.Append($"<td>{status.customStatus}</td>");
                sb.Append($"<td>{status.runtimeStatus}</td>");
                sb.Append($"</tr>");
            }
            ViewBag.rows = sb.ToString();

            return(View("Index"));
        }
Exemplo n.º 2
0
        private string HasVerified(DateTime dateVerified, string eventName, OrchestrationEntity orchestration)
        {
            var hasVerified = dateVerified > TableEntityBase.MinDate;

            if (hasVerified)
            {
                return(dateVerified.ToString("g"));
            }
            var url = orchestration.SendEventPostUri.Replace("{eventName}", eventName);

            return($"<b>no</b> <a href=\"javascript:fEvent('{url}', 'true');\"s>verify</a>");
        }
Exemplo n.º 3
0
        public async Task <IActionResult> VerifyEmail(string id)
        {
            var mgmtUrls = new OrchestrationEntity().Fetch("RegisterOrchestrator", id);
            var eventUrl = mgmtUrls.SendEventPostUri.Replace("{eventName}", "EmailVerified");

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, eventUrl);

            request.Content = new StringContent("true", Encoding.UTF8, "application/json");

            var cl     = clientFactory.CreateClient();
            var result = await cl.SendAsync(request);

            ViewBag.url     = eventUrl;
            ViewBag.content = await result.Content.ReadAsStringAsync();

            ViewBag.resultCode   = result.StatusCode;
            ViewBag.resultPhrase = result.ReasonPhrase;
            return(View("VerifyEmail"));
        }