Beispiel #1
0
        public void Recovery(ModelViewRecovery model)
        {
            var objRepo     = new RepositoryUser();
            var dataUsuario = objRepo.GetEmail(model.Email);

            if (dataUsuario == null)
            {
                throw new Exception("EmailInvalid");
            }

            var NewPassword = GeneratePassword(8);

            dataUsuario.Password       = new BusinessCryptoMD5(GlobalConfiguration.CryptoKey).CryptoString(NewPassword);
            dataUsuario.ChangePassword = true;

            objRepo.Update(dataUsuario);

            List <string> arr = new List <string>();

            arr.Add(model.Email);
            //arr.Add("*****@*****.**");

            var objAlerta = new BusinessNotification();

            //byte[] outMessage = new byte[ResourceMessage.GetStream("NotificationRecoveryBodyContent", culture).Length];
            //ResourceMessage.GetStream("NotificationRecoveryBodyContent", culture).Read(outMessage, 0, (int) ResourceMessage.GetStream("NotificationRecoveryBodyContent", culture).Length);

            //StringBuilder sb = new StringBuilder(UnicodeEncoding.Unicode.GetString(outMessage));
            string sb = File.ReadAllText(GlobalConfiguration.LocateBodyMail + "NotificationRecoveryBodyContent.txt");

            sb = sb.Replace("#%Nombre%#", dataUsuario.Name);
            sb = sb.Replace("#%ClaveTemporal%#", NewPassword);
            var Manager = new ResourceManager("net.paxialabs.mabe.serviplus.resource.Common.ResourceMessage", typeof(ResourceMessage).Assembly);

            //objAlerta.SendMails(arr, Manager.GetString("NotificationRecoveryPassword"), sb.ToString());
            objAlerta.SendMailExchange(GlobalConfiguration.exchangeUser, GlobalConfiguration.exchangePwd, arr, Manager.GetString("NotificationRecoveryPassword"), sb.ToString());
        }
Beispiel #2
0
 public static void Recovery(ModelViewRecovery model)
 {
     new BusinessSecurity().Recovery(model);
 }