public async Task<ActionResult> VerifyTelegramAccount(VerifyTelegramAccountViewModel model) { if (!ModelState.IsValid) { return View(model); } var client = new _2STBVBotClient(); var result = await client.VerifyVerificationCode(model.UserId, model.Code); if (result) { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); if (user != null) { await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); } return RedirectToAction("Index", new { Message = "Telegram account successfully verified" }); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "Failed to verify Telegram account."); return View(model); }
// // GET: /Manage/VerifyTelegramAccount public async Task<ActionResult> VerifyTelegramAccount(string userId) { var client = new _2STBVBotClient(); var token = await client.GetVerificationToken(userId); // Send an SMS through the SMS provider to verify the phone number return userId == null ? View("Error") : View(new VerifyTelegramAccountViewModel { UserId = userId, VerificationToken=token, BotName=ConfigurationManager.AppSettings["2STBVBotName"] }); }