public void ResetPassword() { this.Password = new CrytoUtilsExtensions().Encrypt("pass"); this.UpdatePassword(1); if (!string.IsNullOrEmpty(Email)) { MailSendExtensions mail = new MailSendExtensions(); mail.SendTo.Add(new MailAddress(Email, Name)); mail.Subject = "Call Center Password has been Reset"; string message = "Dear " + Name + Environment.NewLine + Environment.NewLine; message += "The password for your Account on TAC call center system has been reset. Your login credentials are as below" + Environment.NewLine; message += "URL: http://callcenter.tachealthafrica.or.ke" + Environment.NewLine; message += "Username: "******"Password: pass" + Environment.NewLine + Environment.NewLine; message += "You will be prompted to change the password after the first login. Provide a password of your liking." + Environment.NewLine + Environment.NewLine; message += "Regards," + Environment.NewLine; message += "System Admin" + Environment.NewLine + Environment.NewLine; message += "P.S. This is a system generated Email. Do not respond to it."; mail.Message = message; mail.Send(); } }
public IActionResult AddEditUser() { Users user = UserEdit.User; Boolean isNew = false || user.Id.Equals(0); if (user.Role.Id.Equals(3)) { user.AdminRole = UserEdit.Region; } else if (user.Role.Id.Equals(4)) { user.AdminRole = UserEdit.Agency; } else { user.AdminRole = 0; } user.Save(HttpContext); new UserService(HttpContext).UpdateUsersFacilities(user, UserEdit.Facility); if (isNew) { MailSendExtensions mail = new MailSendExtensions(); mail.SendTo.Add(new MailAddress(user.Email, user.Name)); mail.Subject = "Account created on EtbSomalia"; string message = "Dear " + user.Name + System.Environment.NewLine + System.Environment.NewLine; message += "A new Account has been created for you on EtbSomalia System. Your login credentials are as below" + System.Environment.NewLine; message += "URL: http://etbsomalia.worldvision.or.ke" + System.Environment.NewLine; message += "Username: "******"Password: pass" + System.Environment.NewLine + System.Environment.NewLine; message += "You will be prompted to change the password after the first login. Provide a password of your liking." + System.Environment.NewLine + System.Environment.NewLine; message += "Regards," + System.Environment.NewLine; message += "System Admin" + System.Environment.NewLine + System.Environment.NewLine; message += "P.S. This is a system generated Email. Do not respond to it."; mail.Message = message; mail.Send(); } return(LocalRedirect("/administrator/users/")); }