通过 silverlight 进行电子邮件验证

发布于 2024-12-11 18:24:44 字数 233 浏览 0 评论 0原文

我建立了一个 Silverlight 网站,用户可以在其中创建帐户并登录。目前,用户只需通过表单创建帐户并可以直接登录。我想加入电子邮件验证功能,用户将收到一封带有验证 URL 的电子邮件,然后才能登录。我还希望加入忘记密码功能,向用户注册的电子邮件地址发送电子邮件以恢复密码。 我怎样才能在 silverlight 中做到这一点。我使用 Windows SQL Azure 作为后端数据库。我是否必须创建一个单独的应用程序来创建用户帐户和恢复密码?

I've built a Silverlight website where users can create an account and login. Right now, users just create an account through a form and can directly login. I want to incorporate a email verification feature, where the user will receive an email with a verification URL and only then can he login. I also wish to incorporate a forgot password feature that sends an email to the users registered email address to recover password.
How can I do this in silverlight. I'm using Windows SQL Azure as the back-end database. Will I have to create a separate Application for creating user accounts and recovering passwords?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等你爱我 2024-12-18 18:24:44

希望对您有所帮助A 你的问题。

我注意到这篇文章可能会让您有点困惑,所以我决定编写一个方法,可以在最快的时间内为您完成此操作。

public bool Send(string fromEmail, string toEmail, string subject, string body)

     {

        try

         {

             MailMessage message = new MailMessage();

             message.From = new MailAddress(fromEmail);

             message.To.Add(new MailAddress(toEmail));

            message.Subject = subject;

            message.Body = body;

            message.IsBodyHtml = false;



            SmtpClient smtp = new SmtpClient();

            smtp.EnableSsl = true;

            smtp.Send(message);

            return true;

        }

        catch (Exception ex)

        {

            return false;

        }        

    }

本质上,一旦他们创建了帐户,您就需要调用此方法来填写所有变量。确保在您的文本正文中有一个链接,可将他们发送到可以提交“激活”其帐户的页面。

这本质上是数据库中的一个位值,默认情况下设置为 false,并且在他们单击文本正文中的链接中的“提交”或“激活”按钮之前不会设置为 true。

对于密码恢复,您也可以这样做。除了将他们发送到一个页面来激活他们的帐户之外,您还可以将他们发送到一个他们可以重新创建密码的页面。由于数据库不关心密码是旧的还是新的,您可以将它们发送到创建新密码的页面。您甚至不需要为它们创建临时密码(除非您想获得经验并额外小心)。

快乐编码! ;)

Hope this helps you out on part A of your problem.

I noticed the post might throw you off a bit, so I decided to write a method that will do this for you in the quickest amount of time.

public bool Send(string fromEmail, string toEmail, string subject, string body)

     {

        try

         {

             MailMessage message = new MailMessage();

             message.From = new MailAddress(fromEmail);

             message.To.Add(new MailAddress(toEmail));

            message.Subject = subject;

            message.Body = body;

            message.IsBodyHtml = false;



            SmtpClient smtp = new SmtpClient();

            smtp.EnableSsl = true;

            smtp.Send(message);

            return true;

        }

        catch (Exception ex)

        {

            return false;

        }        

    }

Essentially, once they create their account you would want to call this filling out all variables. Make sure in your body of text you have a link that sends them to a page where they can submit "activate" their account.

This will essentially be a bit value in the database that is set to false by default and won't be set to true until they click on the "submit" or "activate" button from the link that would be in the body of text.

For password recovery you would do the same. Except instead of sending them to a page to activate their account you'd send them to a page where they could just re-create their password. Since the database doesn't care if the password is old or new you could just send them to a page where they create a new password. You wouldn't even need to create a temp password for them (Unless you wanted to for experience and for a extra caution).

Happy Coding! ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文