/AnotherStartup/App_Code/Account/Confirm.cs
C# | 43 lines | 34 code | 6 blank | 3 comment | 2 complexity | 501abf6e37130b3b209e7dabe4c29288 MD5 | raw file
- using System.Web.WebPages;
- using WebMatrix.WebData;
-
- namespace Account
- {
- /// <summary>
- /// Summary description for Confirm
- /// </summary>
- public static class Confirm
- {
- public class Error
- {
- public ErrorMessage ConfirmAccount { get; set; }
- public Error()
- {
- ConfirmAccount = ErrorMessage.Nil;
- }
-
- }
-
- public static void Init(WebPageBase web)
- {
- Error error = web.Page.Errors = new Error();
-
- web.Page.Confirmed = false;
-
- var confirmationToken = web.Request["confirmationCode"];
-
- WebSecurity.Logout();
- if (!confirmationToken.IsEmpty())
- {
- if (WebSecurity.ConfirmAccount(confirmationToken))
- {
- web.Page.Confirmed = true;
- }
- else
- {
- error.ConfirmAccount = web.Error("Could not confirm your registration info");
- }
- }
- }
- }
- }