- Timestamp:
- 05/03/16 17:13:50 (9 years ago)
- 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 310 310 } 311 311 } 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 } 334 320 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 } 340 343 341 344 #endregion -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Controllers/UserController.cs
r13805 r13827 132 132 user.UserName = inpusername; 133 133 uid = accessClient.addUser(user); 134 accessClient.RefreshUsers(); 134 135 var newpass = accessClient.resetPassword(uid); 135 136 sendPassmail(accessClient.Users.Find(x => x.Id == uid), newpass); … … 172 173 public static void sendPassmail(Access.User u, string pass) 173 174 {/* 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); 177 176 smtpClient.UseDefaultCredentials = true; 177 smtpClient.Credentials = new System.Net.NetworkCredential("trac.heuristiclab@gmail.com", "||||||||||||"); 178 178 smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; 179 179 smtpClient.EnableSsl = true; … … 181 181 182 182 //Setting From , To and CC 183 mail.From = new MailAddress(" info@MyWebsiteDomainName", "MyWeb Site");183 mail.From = new MailAddress("trac.heuristiclab@gmail.com", "HeuristicLab"); 184 184 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"; 188 189 mail.To.Add(new MailAddress(u.Email)); 189 190
Note: See TracChangeset
for help on using the changeset viewer.