J.K. Rowling has stated that Gilderoy Lockhart is the only character in the Harry Potter series who is based on a real person she knows.
Are any of your characters based on real people?
The only character who is deliberately based on a real person is Gilderoy Lockhart. [Laughter]. Maybe he is not the one that you would think of, but I have to say that the living model was worse. [Laughter]. He was a shocker! The lies that he told about adventures that he’d had, things he’d done and impressive acts that he had committed… He was a shocking man. I can say this quite freely because he will never in a million years dream that he is Gilderoy Lockhart. I am always frightened that he is going to turn up one day. He is just one of those people from your past whom you feel you have never quite shaken off. I will look up one day at a signing and he will say, “Hello, Jo”. [Laughter]. Other people have contributed the odd characteristic, such as a nose, to a character, but the only character who I sat down and thought that I would base on someone is Gilderoy Lockhart. It made up for having to endure him for two solid years.
J.K. Rowling at the Edinburgh Book Festival, in response to a question from the audience, through Accio Quote.
I've read some speculation that it is her ex-husband, Jorge Arantes.
(...) Jorge Arantes, a dashing journalism student three years her junior.
Maria Ines Augiar believed Jorge to be both possessive and jealous, while Steve Cassidy, who ran the school where Rowling worked, viewed him as rough and untrustworthy.
"The JK Rowling story", The Scotsman, June 16th, 2003.
They were married from October 1992 to November 1993, while having met only a couple of months before their wedding, so that's a year and a half at best, not the two years J.K. said she had to endure in her answer. But other characteristics seem to match.
And Hermione, who is generally accepted as an author insertion, does have a crush on Lockhart before he is exposed.
She told how the Daily Express wrongly claimed she based "unpleasant" Potter character Gilderoy Lockhart on her ex-husband Jorge Arantes. It was based on a former flatmate.
"JK Rowling tells Leveson inquiry of her struggles with fame", Daily Mirror, November 25th, 2011
So who is it?