protected void btnSubmit_Click(object sender, EventArgs e) { string body = string.Empty; HomeAppsLib.db.user user = HomeAppsLib.LibCommon.DBModel().users.FirstOrDefault(u => u.email == tbEmail.Text && u.IsActive); if (user != null) { body += "Your login credentials are below:<br>"; body += "Name: " + user.name + "<br>"; body += "Pw: " + new Encryption().Decrypt(user.encPW) + "<br>"; HomeAppsLib.LibCommon.SendSystemEmailWithSignature(user.email, "Credentials requested", body); lblStatus.Text = "We have sent your login info to your registered email address."; } else { body += "Name: " + tbName.Text + "<br>"; body += "Email: " + tbEmail.Text + "<br>"; Common.SendEmail("*****@*****.**", "User requesting credentials", body, tbName.Text); lblStatus.Text = "Request send to system admin... Eric will respond under the Wright family tradition of \"right here directly\", or otherwise known as when he acquires a Round Toit."; } }
internal static void RegisterNewUser(string username, string password, string ip, string emailAddress, string birthday) { Encryption enc = new Encryption(); var data = HomeAppsLib.LibCommon.DBModel(); HomeAppsLib.db.user newUser = new HomeAppsLib.db.user(); newUser.name = username[0].ToString().ToUpper() + username.Substring(1); newUser.encPW = enc.Encrypt(password); newUser.ip_address = ip; newUser.registration_dt = DateTime.Now; newUser.IsActive = true; if (birthday.Trim().Length > 0) { newUser.birthday = Convert.ToDateTime(birthday); } if (!string.IsNullOrEmpty(emailAddress)) { newUser.email = emailAddress; } data.users.InsertOnSubmit(newUser); data.SubmitChanges(); SetAuthenticatedUser(newUser.name); }