Exemple #1
0
Fichier : User.cs Projet : soks/RSS
 public static User GetUserByID(Guid ID)
 {
     RssFeedDBConnection db = new RssFeedDBConnection();
     User user = new User();
     user = db.Users.SingleOrDefault(u => u.ID == ID);
     return user;
 }
Exemple #2
0
        public MembershipUser CreateUser(string username, string password, string email)
        {
            using (RssFeedDBConnection db = new RssFeedDBConnection())
            {
                User user = new User();
                user.ID = Guid.NewGuid();
                user.UserName = username;
                user.Email = email;
                user.PasswordSolt = CreateSalt();
                user.Password = CreatePasswordHash(password, user.PasswordSolt);
                user.CreatedDate = DateTime.Now;
                user.IsActivated = false;
                user.IsLockedOut = false;
                user.LastLockedOutDate = DateTime.Now;
                user.LastLoginDate = DateTime.Now;
                user.NewEmailKey = GenerateKey();
                db.AddToUsers(user);
                db.SaveChanges();
                SendEmailKey(user);

                return GetUser(username);
            }
        }
Exemple #3
0
        private void SendEmailKey(User user)
        {
            string ActivationLink = "http://*****:*****@mail.ru", user.Email)
            {
                Subject = "Activate your account",
                Body = ActivationLink
            };

            var client = new SmtpClient("smtp.mail.ru");
            client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "soks123");

            client.Send(message);
        }
Exemple #4
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="lastUpdate">Initial value of the LastUpdate property.</param>
 /// <param name="passwordSolt">Initial value of the PasswordSolt property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="lastLoginDate">Initial value of the LastLoginDate property.</param>
 /// <param name="isActivated">Initial value of the IsActivated property.</param>
 /// <param name="isLockedOut">Initial value of the IsLockedOut property.</param>
 /// <param name="lastLockedOutDate">Initial value of the LastLockedOutDate property.</param>
 public static User CreateUser(global::System.Guid id, global::System.String userName, global::System.String password, global::System.String email, global::System.DateTime lastUpdate, global::System.String passwordSolt, global::System.DateTime createdDate, global::System.DateTime lastLoginDate, global::System.Boolean isActivated, global::System.Boolean isLockedOut, global::System.DateTime lastLockedOutDate)
 {
     User user = new User();
     user.ID = id;
     user.UserName = userName;
     user.Password = password;
     user.Email = email;
     user.LastUpdate = lastUpdate;
     user.PasswordSolt = passwordSolt;
     user.CreatedDate = createdDate;
     user.LastLoginDate = lastLoginDate;
     user.IsActivated = isActivated;
     user.IsLockedOut = isLockedOut;
     user.LastLockedOutDate = lastLockedOutDate;
     return user;
 }
Exemple #5
0
 /// <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);
 }