public EditMembershipUserModel(MembershipUser membershipUser) { this.UserName = membershipUser.UserName; this.Email = membershipUser.Email; this.IsApproved = membershipUser.IsApproved; this.IsLockedOut = membershipUser.IsLockedOut; this.PasswordQuestion = membershipUser.PasswordQuestion; this.PasswordAnswer = membershipUser.PasswordAnswer; this.Culture = membershipUser.Culture; this.TimeZoneId = membershipUser.TimeZoneId; this.Comment = membershipUser.Comment; this.Profiles = membershipUser.Profiles; this.MembershipGroups = membershipUser.MembershipGroups; this.ProviderType = membershipUser.ProviderType; this.ProviderUserId = membershipUser.ProviderUserId; this.ProviderExtraData = membershipUser.ProviderExtraData; }
public virtual ActionResult Delete(MembershipUser[] model) { ModelState.Clear(); var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (model != null) { foreach (var o in model) { o.Membership = Membership; _manager.Delete(o); } } data.ReloadPage = true; }); return Json(data); }
public virtual ActionResult Edit(string uuid) { var membershipUser = new MembershipUser() { Membership = Membership, UUID = uuid }.AsActual(); var editModel = new EditMembershipUserModel(membershipUser); return View(editModel); }
public virtual ActionResult IsUserNameAvailable(string userName) { var membershipUser = new MembershipUser() { Membership = Membership, UserName = userName }.AsActual(); if (membershipUser != null) { return Json(string.Format("{0} is duplicate.".Localize(), userName), JsonRequestBehavior.AllowGet); } return Json(true, JsonRequestBehavior.AllowGet); }
protected virtual void SendActivateMail(ControllerContext controllerContext, Site site, MembershipUser memberUser, RegisterMemberModel registerMemberModel, string activateCode) { var smtp = site.Smtp; if (smtp == null) { throw new ArgumentNullException("smtp"); } var activateUrl = registerMemberModel.ActivateUrl; if (string.IsNullOrEmpty(activateUrl)) { throw new ArgumentNullException("ActivateUrl is required."); } activateUrl = string.Format(ContextHelper.ResolveSiteUrl(controllerContext, activateUrl) , memberUser.UserName, activateCode); activateUrl = UrlUtility.ToHttpAbsolute(activateUrl); MailMessage message = new MailMessage() { From = new MailAddress(smtp.From) }; message.To.Add(registerMemberModel.Email); message.Subject = registerMemberModel.ActivateEmailSubject; message.Body = string.Format(registerMemberModel.ActivateEmailBody, activateUrl); message.IsBodyHtml = true; SmtpClient smtpClient = smtp.ToSmtpClient(); smtpClient.Send(message); }