Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/16 17:13:50 (9 years ago)
Author:
jlodewyc
Message:

#2582 Parameter changing busy, save file, download file and email on pass reset

Location:
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/JobController.cs

    r13754 r13827  
    310310            }
    311311        }
    312         //TODO Work in progress
    313         /* public async Task<IActionResult> DownloadFile(int index, int filedex)
    314          {
    315              if (((HiveServiceLocatorWeb)(HiveServiceLocatorWeb.Instance)).CheckLogin())
    316              {
    317                  UploadedJobViewModel upper = new UploadedJobViewModel();
    318                  fillUploadsPaths(upper, index);
    319 
    320                 HttpContext.Response.ContentType = "APPLICATION/OCTET-STREAM";
    321                  String Header = "Attachment; Filename=" + upper.DisplayFilesPaths[filedex];
    322                  HttpContext.Response.Headers.Add("Content-Disposition", Header);
    323                  System.IO.FileInfo Dfile = new System.IO.FileInfo(upper.FullFilesPaths[filedex]);
    324                  await HttpContext.Response.WriteAsync(Dfile.FullName);
    325                  //HttpContext.Response.End();
    326 
    327                  var message = upper.DisplayFilesPaths[filedex] + " has been downloaded";
    328 
    329                  upper.message = message;
    330                  ViewBag.Title = "Downloaded file";
    331 
    332                  return View("Uploads", upper);
    333              }
     312        [HttpPost]
     313        public IActionResult saveToFile(string fname)
     314        {
     315            if (init())
     316            {
     317                weblog.getFileOpener(userId).SaveToFile(fname);
     318                return RedirectToAction("Uploads", "Job");
     319            }
    334320             else
    335              {
    336                  HiveServiceLocatorWeb.SetLoginErrorMessage();
    337                  return RedirectToAction("Index", "Home");
    338              }
    339          }*/
     321            {
     322                return RedirectToAction("Index", "Home");
     323            }
     324        }
     325
     326        public FileResult DownloadFile(int index, int filedex)
     327        {
     328            if (init())
     329            {
     330                UploadedJobViewModel upper = new UploadedJobViewModel();
     331                fillUploadsPaths(upper, index);
     332
     333                System.IO.FileInfo Dfile = new System.IO.FileInfo(upper.FullFilesPaths[filedex]);
     334                var fileName = Dfile.Name;
     335                byte[] fileBytes = System.IO.File.ReadAllBytes(upper.FullFilesPaths[filedex]);
     336                return File(fileBytes, "application/x-msdownload", fileName);
     337            }
     338            else
     339            {
     340                return null;
     341            }
     342        }
    340343
    341344        #endregion
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs

    r13805 r13827  
    132132                    user.UserName = inpusername;
    133133                    uid = accessClient.addUser(user);
     134                    accessClient.RefreshUsers();
    134135                    var newpass = accessClient.resetPassword(uid);
    135136                    sendPassmail(accessClient.Users.Find(x => x.Id == uid), newpass);
     
    172173        public static void sendPassmail(Access.User u, string pass)
    173174        {/*
    174             SmtpClient smtpClient = new SmtpClient("mail.MyWebsiteDomainName.com", 25);
    175 
    176             smtpClient.Credentials = new System.Net.NetworkCredential("info@MyWebsiteDomainName.com", "myIDPassword");
     175            SmtpClient smtpClient = new SmtpClient("smtp.gmail.com",587);
    177176            smtpClient.UseDefaultCredentials = true;
     177            smtpClient.Credentials = new System.Net.NetworkCredential("trac.heuristiclab@gmail.com", "||||||||||||");
    178178            smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    179179            smtpClient.EnableSsl = true;
     
    181181
    182182            //Setting From , To and CC
    183             mail.From = new MailAddress("info@MyWebsiteDomainName", "MyWeb Site");
     183            mail.From = new MailAddress("trac.heuristiclab@gmail.com", "HeuristicLab");
    184184            mail.Subject = "Password changed - HeuristicLab Hive";
    185             mail.Body = "Hello " + u.FullName + ", " +
    186                 "Your password was changed through the HeuristicLab Hive web application." +
    187                 "The new password for " + u.UserName + " is '" + pass + "'.";
     185            mail.Body = "Hello " + u.FullName + ", " + Environment.NewLine + Environment.NewLine+
     186                "Your password was changed through the HeuristicLab Hive web application." + Environment.NewLine+
     187                "The new password for " + u.UserName + " is ' " + pass + " '." + Environment.NewLine + Environment.NewLine +
     188                "HeuristicLab Hive";
    188189            mail.To.Add(new MailAddress(u.Email));
    189190
Note: See TracChangeset for help on using the changeset viewer.