public string Register(JSONRegister datos) { UsuarioSet user = new UsuarioSet(); user.NombreUsuario = datos.username; byte[] salt; new RNGCryptoServiceProvider().GetBytes(salt = new byte[16]); var pbkdf2 = new Rfc2898DeriveBytes(datos.passwd, 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); user.Password = savedPasswordHash; user.Correo = datos.correo; user.Foto = "foto"; user.Notificacion = "YES"; user.CreateDate = DateTime.Today; user.Token = Guid.NewGuid().ToString(); _dalUsers.AddUser(user); return(Login(user.NombreUsuario, datos.passwd)); }
public void Post([FromBody] JSONRegister value) { _srvUsuarios.Register(value); }