Ruling on a man teaching girls without any barrier
Question

                I am a young man and I have been letting my beard grow for nearly a year and I am trying to do acts of worship and keep away from forbidden things as much as I can. But I have been faced with the problem of finding work, until I found a job teaching in a high school for girls. I want to know whether it is permissible for me to carry on in this job. What is the ruling on the money that I have earned from it up till now?.
Praise be to Allah.For a man to 
    work as a teacher in a high school for girls, where he meets them with no 
    barrier and most of them may adorn themselves and show their charms – as is 
    the case in the country where the questioner lives – no wise man would doubt 
    that this is haraam, because of the bad effects and evil results for both 
    men and women. We have discussed these evil results in the answer to 
    question no. 50398. 
It says in
    Fataawa al-Lajnah al-Daa’imah (12/149): It is not permissible for a 
    man to teach girls directly because of the serious dangers and grave 
    consequences involved in that. 
It also says 
    (12/156): 
Firstly: 
    Mixing between men and women in schools and elsewhere is a great evil which 
    may corrupt religious commitment and worldly interests. It is not 
    permissible for a woman to teach or work in a place where men and women mix, 
    and it is not permissible for her guardian to give her permission to do 
    that. 
Secondly: it 
    is not permissible for a man to teach a woman who is not wearing hijab, and 
    it is not permissible for him to teach her when he is alone with her, even 
    if she is wearing proper hijab. When a woman is with a man who is a 
    non-mahram her entire being is ‘awrah. As for covering the head and showing 
    the face, this is not full hijab. 
Thirdly: 
    there is nothing wrong with a man teaching a woman from behind a screen in 
    women-only schools, where there is no mixing between male and female 
    students, or between the (male) teacher and (female) students. 
If they need 
    to ask him questions, it should be means of closed circuit TV, which is well 
    known and easily available, or via the phone, but the students should beware 
    of speaking softly. End quote. 
Secondly: 
With regard 
    to what you have earned from this work, there is nothing wrong with your 
    benefiting from it, because this salary that you have earned is in return 
    for giving lessons (which is basically permissible work), and the 
    prohibition is because of the mixing, as stated above. 
But you 
    should hasten to leave this job and look for another job which is free of 
    the risk of doing something haraam and falling into fitnah. 
We ask 
    Allaah to guide us and you. 
And Allaah knows 
    best.