public string UploadEvaluator(ServerEvaluator myEval) { Console.WriteLine("upload. eval string: " + myEval.ToString()); string idCode; Random rnd = new Random(); string password = myEval.Name + rnd.Next().ToString(); string hashed = BCrypt.HashPassword(password, BCrypt.GenerateSalt(10)); //insert the password in the server and the hash in the client myEval.Code = password; int id = myEval.InsertAtDB(false); //do insertion return(id.ToString() + ":" + hashed); }
protected void on_button_accept_clicked(object o, EventArgs args) { eval.Name = entry_name.Text.ToString(); eval.Email = entry_email.Text.ToString(); eval.DateBorn = dateTime; eval.CountryID = Convert.ToInt32( Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries)); eval.Comments = textview_comments.Buffer.Text; if (radio_cp_undef.Active) { eval.Chronometer = Constants.UndefinedDefault; } else if (radio_cp1.Active) { eval.Chronometer = Constants.ChronometerCp1; } else if (radio_cp2.Active) { eval.Chronometer = Constants.ChronometerCp2; } else if (radio_cp3.Active) { eval.Chronometer = Constants.ChronometerCp3; } else { eval.Chronometer = entry_cp_other.Text.ToString(); } if (radio_device_undef.Active) { eval.Device = Constants.UndefinedDefault; } else if (radio_contact_steel.Active) { eval.Device = Constants.DeviceContactSteel; } else if (radio_contact_modular.Active) { eval.Device = Constants.DeviceContactCircuit; } else if (radio_infrared.Active) { eval.Device = Constants.DeviceInfrared; } else { eval.Device = entry_device_other.Text.ToString(); } changed = false; if (creating) { eval.InsertAtDB(false); changed = true; } else { //1st see if there are changes if (eval.Equals(evalBefore)) { //nothing changed // //new DialogMessage(Constants.MessageTypes.INFO, "nothing changed.\n"); } else { //changed eval.Update(false); changed = true; } } fakeButtonAccept.Click(); EvaluatorWindowBox.evaluator_window.Hide(); EvaluatorWindowBox = null; }
public string UploadEvaluator(ServerEvaluator myEval) { Console.WriteLine("upload. eval string: " + myEval.ToString()); string idCode; Random rnd = new Random(); string password = myEval.Name + rnd.Next().ToString(); string hashed = BCrypt.HashPassword(password, BCrypt.GenerateSalt(10)); //insert the password in the server and the hash in the client myEval.Code = password; int id = myEval.InsertAtDB(false); //do insertion return id.ToString() + ":" + hashed; }