public ActionResult Register(CreateJobOfferModel model, int clientid) { if (ModelState.IsValid) { if (model.Password != model.RepeatPassword) { throw new ITPProException("Slaptažodis blogai įvestas"); } byte[] salt; new RNGCryptoServiceProvider().GetBytes(salt = new byte[16]); var pbkdf2 = new Rfc2898DeriveBytes(model.Password, salt, 10000); byte[] hash = pbkdf2.GetBytes(20); byte[] hashBytes = new byte[36]; Array.Copy(salt, 0, hashBytes, 0, 16); Array.Copy(hash, 0, hashBytes, 16, 20); string savedPasswordHash = Convert.ToBase64String(hashBytes); var jobOffer = repository.Set <Darbo_uzklausa>().Add(new Darbo_uzklausa { pareigos = model.Job, fk_Klientaskliento_kodas = clientid, fk_Darbuotojasdarbuojo_kodas = CurrentUser.UserId, slaptazodis = savedPasswordHash }); repository.SaveChanges(); return(RedirectToAction("Sistemos_klientu_langas")); } return(View(model)); }
public ActionResult Darbuotojo_roles_paskyrimo_langas(int clientid) { try { var model = new CreateJobOfferModel(); if (clientid > 0) { ViewData["code"] = clientid; } return(View(model)); } catch (ITPProException ex) { return(RedirectToAction("Sistemos_klientu_langas")); } }