Example #1
0
 private ActionResult AddPhoneNumberView(AddPhoneNumberViewModel model)
 {
     return View(ViewNames.AddPhoneNumber, model);
 }
Example #2
0
 private ActionResult RedirectToVerifyPhoneNumber(AddPhoneNumberViewModel model)
 {
     return RedirectToAction(ActionNames.VerifyPhoneNumber, new {PhoneNumber = model.Number});
 }
Example #3
0
 public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return AddPhoneNumberView(model);
     }
     // トークンを生成して送信します。
     var code = await UserManager.GenerateChangePhoneNumberTokenAsync(UserId, model.Number);
     if (UserManager.SmsService == null)
         return RedirectToVerifyPhoneNumber(model);
     var message = new IdentityMessage
     {
         Destination = model.Number,
         Body = "あなたのセキュリティ コード: " + code
     };
     await UserManager.SmsService.SendAsync(message);
     return RedirectToVerifyPhoneNumber(model);
 }
Example #4
0
 public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     // Generate the token and send it
     var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
     if (UserManager.SmsService != null)
     {
         var message = new IdentityMessage
         {
             Destination = model.Number,
             Body = "Your security code is: " + code
         };
         await UserManager.SmsService.SendAsync(message);
     }
     return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
 }