Although both face recognition and object inpainting have become promising approaches through the use of deep learning, the COVID-19 pandemic has created a tremendous challenge to their further development. Masks, which people have become accustomed to as an effective sanitary measure to prevent infection of COVID-19, have also become an undeniable physical barrier between devices applying face recognition authentication and the faces to be recognized. Therefore, methods that can overcome this dilemma are urgently needed. This study proposes a method that applies a generative model to recognize masked faces based on face inpainting. We introduced a newly proposed identity loss term to conform to the identity information. The reconstructed face will be fed into a face recognition network to extract the feature embeddings for a distance comparison. Taking a naive generative model without an identity loss term introduced as the baseline, the model with an identity loss term improves the recognition accuracy by more than 4%.