Exemple #1
0
 public static void SendPasswordResetKey(User user, string subject, string body)
 {
     var db = new SecurityEntities();
     var userId = user.UserId;
     var m = db.Memberships.FirstOrDefault(x => x.UserId == userId);
     var resetKey = m.GetPasswordResetToken();
     var resetUrl = JocysCom.ClassLibrary.Security.Helper.GetUrl(PasswordResetKey, resetKey);
     var u = System.Web.HttpContext.Current.Request.Url;
     subject = subject.Replace("{Host}", u.Host);
     body = JocysCom.ClassLibrary.Text.Helper.Replace(body, user, false);
     body = body.Replace("{Host}", u.Host).Replace("{ResetKey}", resetUrl);
     var helper = JocysCom.ClassLibrary.Runtime.LogHelper.Current;
     helper.SendMailFrom(helper.Smtp.SmtpFrom, m.Email, "", "", subject, body, true);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="applicationId">Initial value of the ApplicationId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="loweredUserName">Initial value of the LoweredUserName property.</param>
 /// <param name="isAnonymous">Initial value of the IsAnonymous property.</param>
 /// <param name="lastActivityDate">Initial value of the LastActivityDate property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="gender">Initial value of the Gender property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static User CreateUser(global::System.Guid applicationId, global::System.Guid userId, global::System.String userName, global::System.String loweredUserName, global::System.Boolean isAnonymous, global::System.DateTime lastActivityDate, global::System.String firstName, global::System.String lastName, global::System.String gender, global::System.String description)
 {
     User user = new User();
     user.ApplicationId = applicationId;
     user.UserId = userId;
     user.UserName = userName;
     user.LoweredUserName = loweredUserName;
     user.IsAnonymous = isAnonymous;
     user.LastActivityDate = lastActivityDate;
     user.FirstName = firstName;
     user.LastName = lastName;
     user.Gender = gender;
     user.Description = description;
     return user;
 }