예제 #1
0
        public Member Add(NewMemberModel newMember)
        {
            Member member = new Member
            {
                Username = newMember.Username,
                FirstName = newMember.FirstName,
                LastName = newMember.LastName,
                Email = newMember.Email,
                LastActivity = DateTime.Now,
                Password = Crypto.HashPassword(newMember.Password)
            };

            db.Members.Add(member);
            db.SaveChanges();

            return member;
        }
예제 #2
0
        public void ResetPassword(Member member)
        {
            string newPassword = GeneratePassword(8);
            member.Password = Crypto.HashPassword(newPassword);
            db.SaveChanges();

            //try
            //{
            //    string emailbody = "Your password has been reset per your request. Your new password is: " + currentMember.Password + ". Please log in and change it as soon as you can.";

            //    WebMail.SmtpServer = "my.smtp.server";
            //    WebMail.Send(currentMember.Email.ToString(),
            //                 "Politiq - Password Reset",
            //                 emailbody,
            //                 "*****@*****.**"
            //                );
            //}
            //catch (Exception)
            //{
            //    // Exception
            //}
        }