Miguelmorin's answer is very comprehensive, and if you do want to make a repair, I would definitely recommend following his guidance, however:
Your leash can be the difference between life and death or at the very least saves loss of your possibly expensive surfboard so it is not worth the risk of having it go when you need it the most, for example when you ...
Temporary solutions until you can get a new leash
Below is a list of solutions I tried. With any solution, use the repaired leash on small surf days and when the break has no beach-goers in case it fails again. As this page mentions, a new leash is a small price to avoid the risk of injuring another person.
If the leash is broken in the middle
In the Falklands, because the water is so cold as it comes up off the Antarctic peninsula, I always wore 6mm wetsuits even for kayaking. The two solutions we used were:
talc. Yes, it gets wet, but really helps with seals round wrists and ankles
a friend and solidly rooted poles or bars. Much easier to peel someone else out of a thick wetsuit.