protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { SageFrameConfig pb = new SageFrameConfig(); string ActivationCode = string.Empty; if (Request.QueryString["ActivationCode"] != null) { ActivationCode = Request.QueryString["ActivationCode"].ToString(); try { ActivationCode = EncryptionMD5.Decrypt(ActivationCode); } catch { ShowMessage("", GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert); return; } ForgotPasswordInfo sageframeuser = new ForgotPasswordInfo(); sageframeuser = UserManagementController.GetUsernameByActivationOrRecoveryCode(ActivationCode, GetPortalID); if (sageframeuser.CodeForUsername != null) { if (!sageframeuser.IsAlreadyUsed) { string UserName = _member.ActivateUser(ActivationCode, GetPortalID); if (!String.IsNullOrEmpty(UserName)) { UserInfo user = _member.GetUserDetails(GetPortalID, UserName); if (user.UserExists) { List <ForgotPasswordInfo> messageTemplates = UserManagementController.GetMessageTemplateListByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID); foreach (ForgotPasswordInfo messageTemplate in messageTemplates) { DataTable dtActivationSuccessfulTokenValues = UserManagementController.GetActivationSuccessfulTokenValue(user.UserName, GetPortalID); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues); try { MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert); return; } } ForgotPasswordInfo template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_INFORMATION, GetPortalID); if (template != null) { ACTIVATION_INFORMATION.Text = template.Body; } ; LogInPublicModeRegistration(user); } else { ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert); } } else { ForgotPasswordInfo template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID); if (template != null) { ACTIVATION_INFORMATION.Text = template.Body; } ; } } else { ShowMessage("", GetSageMessage("UserRegistration", "ActivationCodeAlreadyUsed"), "", SageMessageType.Alert); } } else { ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert); } } } catch (Exception ex) { ProcessException(ex); } } }
protected void Page_Load(object sender, EventArgs e) { SageFrameConfig pagebase = new SageFrameConfig(); IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls); hypGotoLogin.Text = GetSageMessage("UserRegistration", "GoToLogin"); if (IsUseFriendlyUrls) { if (GetPortalID > 1) { hypGotoLogin.NavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx"); } else { hypGotoLogin.NavigateUrl = ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx"); } } else { hypGotoLogin.NavigateUrl = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage)); } if (!IsPostBack) { try { MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString); string ActivationCode = string.Empty; if (Request.QueryString["ActivationCode"] != null) { ActivationCode = Request.QueryString["ActivationCode"].ToString(); try { ActivationCode = EncryptionMD5.Decrypt(ActivationCode); } catch { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert); return; } UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString); var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(ActivationCode, GetPortalID).SingleOrDefault(); if (sageframeuser.CodeForUsername != null) { if (!(bool)(sageframeuser.IsAlreadyUsed)) { string UserName = _member.ActivateUser(ActivationCode, GetPortalID, GetStoreID); if (!String.IsNullOrEmpty(UserName)) { UserInfo user = _member.GetUserDetails(GetPortalID, UserName); if (user.UserExists) { var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues); try { MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert); return; } } ACTIVATION_INFORMATION.Text = GetSageMessage("UserRegistration", "ActivationSuccessfulInfo"); //ShowMessage("", GetSageMessage("UserRegistration", "ActivationSuccessfulInfo"), "", SageMessageType.Alert); } else { ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert); } } else { var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ACTIVATION_INFORMATION.Text = template.Body; } ; } } else { ShowMessage("", GetSageMessage("UserRegistration", "ActivationCodeAlreadyUsed"), "", SageMessageType.Alert); } } else { ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert); } } } catch (Exception ex) { ProcessException(ex); } } }