I need to create users in ASP.Net Core without providing the passowrd as it will reset by the user itself after receiving the confirmation email with temporary credentials.
Years ago, I did something similar using MVC4 by generating automatically a password and then by adding the user in the DB and then sending a new user confirmation email:
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);
How would you do something similar with ASP.Net Core identity?
Thank you
Sylvain