Как реализовать пароль reset в приложении MVC2?
Пароли хэшируются с использованием поставщика членства ASP.NET. Вопрос восстановления пароля не используется. Используется стандартный шаблон проекта ASP.NET MVC2 со стандартным классом AccountController.
Если пользователь выдает пароль, электронная почта с временной ссылкой или с новым паролем должна быть отправлена на адрес электронной почты пользователя.
Где найти код для реализации этого в MVC 2 С#?
переполнение стека содержит два ответа, в которых обсуждаются методы его реализации. Не существует образца кода. Я googled для "asp.net mvc password reset С# sample code download", но havent нашел пример кода для этого.
Я новичок в MVC. Где найти пример кода для восстановления пароля? Это отсутствует в шаблоне проекта VS2010.
Обновление
Я пробовал этот код в Mono 2.10, но получил исключение:
CspParameters, не поддерживаемые Mono
в строке
des.Key = pdb.CryptDeriveKey("RC2", "MD5", 128, new byte[8]);
Как запустить его в Mono?
Трассировка стека:
System.NotSupportedException: CspParameters not supported by Mono
at System.Security.Cryptography.PasswordDeriveBytes.CryptDeriveKey (string,string,int,byte[]) [0x0001b] in /usr/src/redhat/BUILD/mono-2.10.2/mcs/class/corlib/System.Security.Cryptography/PasswordDeriveBytes.cs:197
at store2.Helpers.Password.EncodeMessageWithPassword (string,string) <IL 0x00055, 0x000f3>
at store2.Helpers.AccountHelper.GetTokenForValidation (string) <IL 0x00033, 0x00089>
at MvcMusicStore.Controllers.AccountController.PasswordReminder (MvcMusicStore.Models.PasswordReminderModel) <IL 0x001ac, 0x00495>
at (wrapper dynamic-method) System.Runtime.CompilerServices.ExecutionScope.lambda_method (System.Runtime.CompilerServices.ExecutionScope,System.Web.Mvc.ControllerBase,object[]) <IL 0x00020, 0x0005b>
at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase,object[]) <IL 0x00008, 0x0001b>
at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext,System.Collections.Generic.IDictionary`2<string, object>) <IL 0x00072, 0x00103>
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor,System.Collections.Generic.IDictionary`2<string, object>) <IL 0x00003, 0x00019>
at System.Web.Mvc.ControllerActionInvoker/<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a () <IL 0x0002d, 0x00068>
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter (System.Web.Mvc.IActionFilter,System.Web.Mvc.ActionExecutingContext,System.Func`1<System.Web.Mvc.ActionExecutedContext>) <IL 0x00031, 0x000b6>
--------------------------------------------------------------------------------
Version information: Mono Runtime Version: 2.10.2 (tarball Mon Apr 18 18:57:39 UTC 2011); ASP.NET Version: 2.0.50727.1433