コード例 #1
0
ファイル: UserLogin.cs プロジェクト: rwschultz/schultzlegend
 public static void SendConfirmEmail(UserLogin user)
 {
     MailMessage mail = new MailMessage("*****@*****.**", user.Email);
     SmtpClient client = new SmtpClient("email-smtp.us-west-2.amazonaws.com", 587);
     client.Credentials = new NetworkCredential("AKIAJJQHYH6YBXOFJNXQ", "AvQXrFMjY1HJCH8mAyQzxevxNda6eNieRVKJLhiwUUA2");
     client.EnableSsl = true;
     mail.Subject = "Confirm Your Email Address - Schultz Legend";
     mail.Body = String.Format("Thank you for registering at SchultzLegend.com\n\nPlease click the link to confirm your email:\nhttp://www.schultzlegend.com/ConfirmEmail?token={0}", user.Id);
     client.Send(mail);
 }
コード例 #2
0
ファイル: DBHelper.cs プロジェクト: rwschultz/schultzlegend
        public static UserLogin DBGetUserLoginFromToken(string token)
        {
            UserLogin user = new UserLogin();

            MySqlConnection cn = new MySqlConnection(ConfigurationManager.ConnectionStrings["sldbConnectionString"].ConnectionString);
            MySqlCommand cmd = new MySqlCommand();

            string sSql = String.Format("CALL `schultzlegenddb`.`USER_GET_LOGIN_FROM_TOKEN`('{0}');", token);

            cmd.Connection = cn;
            cmd.CommandText = sSql;
            cmd.Connection.Open();
            MySqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            if (reader.Read())
            {
                user.Id = Convert.ToString(reader["id"]);
                user.Email = Convert.ToString(reader["email"]);
                user.EmailConfirmed = Convert.ToBoolean(reader["email_conf"]);
                user.PasswordHash = Convert.ToString(reader["phash"]);
            }
            else
            {
                reader.Close();
                cmd.Connection.Close();
                return null;
            }
            reader.Close();
            cmd.Connection.Close();
            return user;
        }