欢迎来到天天文库
浏览记录
ID:950218
大小:51.00 KB
页数:14页
时间:2017-10-06
《csharp代码-xi》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、CSharp源码(Kit1335)//POST:/Manage/DisableTwoFactorAuthentication[HttpPost][ValidateAntiForgeryToken]publicasyncTaskDisableTwoFactorAuthentication(){awaitUserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(),false);varuser=awaitUserManager.Fin
2、dByIdAsync(User.Identity.GetUserId());if(user!=null){awaitSignInManager.SignInAsync(user,isPersistent:false,rememberBrowser:false);}returnRedirectToAction("ShopManage","Manage");}////GET:/Manage/VerifyPhoneNumberpublicasyncTaskVerifyPhoneNumber(stri
3、ngphoneNumber){varcode=awaitUserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(),phoneNumber);//通过SMS提供程序发送短信以验证电话号码returnphoneNumber==null?View("Error"):View(newVerifyPhoneNumberViewModel{PhoneNumber=phoneNumber});}////POST:/Manage/VerifyPho
4、neNumber[HttpPost][ValidateAntiForgeryToken]publicasyncTaskVerifyPhoneNumber(VerifyPhoneNumberViewModelmodel){if(!ModelState.IsValid){returnView(model);}varresult=awaitUserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(),model.PhoneNumber,mo
5、del.Code);if(result.Succeeded){varuser=awaitUserManager.FindByIdAsync(User.Identity.GetUserId());if(user!=null){awaitSignInManager.SignInAsync(user,isPersistent:false,rememberBrowser:false);}returnRedirectToAction("ShopManage",new{MessageFt.yu.Fix=ManageMessageFt
6、.yu.FixFixFixId.AddPhoneSuccess});}//如果我们进行到这一步时某个地方出错,则重新显示表单ModelState.AddModelError("","无法验证电话号码");returnView(model);}////GET:/Manage/RemovePhoneNumberpublicasyncTaskRemovePhoneNumber(){varresult=awaitUserManager.SetPhoneNumberAsync(User.Identity
7、.GetUserId(),null);if(!result.Succeeded){returnRedirectToAction("ShopManage",new{MessageFt.yu.Fix=ManageMessageFt.yu.FixFixFixId.Error});}varuser=awaitUserManager.FindByIdAsync(User.Identity.GetUserId());if(user!=null){awaitSignInManager.SignInAsync(user,isPersis
8、tent:false,rememberBrowser:false);}returnRedirectToAction("ShopManage",new{MessageFt.yu.Fix=ManageMessageFt.yu.FixFixFixId.RemovePhoneSuccess});}////GET:/Manag
此文档下载收益归作者所有