protected void wzdPasswordRecover_NextButtonClick(object sender, WizardNavigationEventArgs e)
 {
     try
     {
         if (txtPassword.Text != null && txtRetypePassword.Text != "" && txtRetypePassword.Text == txtPassword.Text)
         {
             if (txtPassword.Text.Length < 4)
             {
                 ShowMessage("", GetSageMessage("PasswordRecovery", "PasswordLength"), "", SageMessageType.Alert);
                 e.Cancel = true;
             }
             else
             {
                 if (hdnRecoveryCode.Value != "")
                 {
                     sageframeuser = UserManagementController.GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID);
                     if (sageframeuser.CodeForUsername != null)
                     {
                         UserInfo userOld = m.GetUserDetails(GetPortalID, sageframeuser.CodeForUsername);
                         string   Password, PasswordSalt;
                         PasswordHelper.EnforcePasswordSecurity(m.PasswordFormat, txtPassword.Text, out Password, out PasswordSalt);
                         UserInfo user = new UserInfo(userOld.UserID, Password, PasswordSalt, m.PasswordFormat);
                         m.ChangePassword(user);
                         List <ForgotPasswordInfo> messageTemplates = UserManagementController.GetMessageTemplateListByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCCESSFUL_EMAIL, GetPortalID);
                         foreach (ForgotPasswordInfo messageTemplate in messageTemplates)
                         {
                             DataTable dtTokenValues           = UserManagementController.GetPasswordRecoverySuccessfulTokenValue(userOld.UserName, GetPortalID);
                             string    replacedMessageSubject  = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtTokenValues);
                             string    replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtTokenValues);
                             try
                             {
                                 MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, userOld.Email, replacedMessageSubject, replacedMessageTemplate, string.Empty, string.Empty);
                             }
                             catch (Exception)
                             {
                                 ShowMessage("", GetSageMessage("PasswordRecovery", "SecureConnectionFPRError"), "", SageMessageType.Alert);
                                 e.Cancel = true;
                                 divRecoverpwd.Visible = false;
                             }
                         }
                         UserManagementController.DeactivateRecoveryCode(userOld.UserName, GetPortalID);
                         ForgotPasswordInfo template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID);
                         if (template != null)
                         {
                             ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body;
                         }
                     }
                     else
                     {
                         e.Cancel = true;
                         ShowMessage("", GetSageMessage("PasswordRecovery", "UnknownErrorPleaseTryAgaing"), "", SageMessageType.Alert);
                     }
                 }
                 else
                 {
                     e.Cancel = true;
                     ShowMessage("", GetSageMessage("PasswordRecovery", "UnknownError"), "", SageMessageType.Alert);
                 }
             }
         }
         else
         {
             ShowMessage("", GetSageMessage("PasswordRecovery", "PleaseEnterAllRequiredFields"), "", SageMessageType.Alert);
             e.Cancel = true;
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }