0
我需要在ASP.Net Core中創建用戶,而不提供passowrd,因爲用戶在收到帶有臨時憑證的確認電子郵件後會自行重置密碼。以ASP.Net的名義創建用戶核心身份 - 自動生成密碼
幾年前,我沒有使用MVC4通過生成自動輸入密碼,然後類似的東西,加入DB中的用戶,然後發送一個新用戶的確認電子郵件:
String password = Membership.GeneratePassword(10, 3);
WebSecurity.CreateUserAndAccount(model.UserName, password, new { Organization = model.SelectedOrganization, Email = model.Email });
Roles.AddUserToRole(model.UserName, model.SelectedRole);
IDictionary<string, string> data = new Dictionary<string, string>();
data.Add("name", model.UserName);
data.Add("password", password);
String subject = String.Format("\"{0}\" - You can now connect to Web Tagging Data System ", model.UserName);
String body = new TemplatingService().GetTemplatedDocument("NewUserEmail.vm", data);
new EmailServices().SendEmail(subject, body, model.Email);
MessageModel messageModel = new MessageModel();
messageModel.Body = "An email has been sent to this user with its credentials";
return View("Message", messageModel);
你會如何做類似的事情ASP.Net核心身份?
謝謝
西爾